Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
1722663a
Commit
1722663a
authored
12 years ago
by
Shudong Zhou
Browse files
Options
Downloads
Patches
Plain Diff
BSC-3426 Add log message for port status change
parent
6d3e72a3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/net/floodlightcontroller/core/internal/Controller.java
+15
-3
15 additions, 3 deletions
...va/net/floodlightcontroller/core/internal/Controller.java
src/main/java/org/openflow/protocol/OFPhysicalPort.java
+34
-2
34 additions, 2 deletions
src/main/java/org/openflow/protocol/OFPhysicalPort.java
with
49 additions
and
5 deletions
src/main/java/net/floodlightcontroller/core/internal/Controller.java
+
15
−
3
View file @
1722663a
...
@@ -1106,19 +1106,31 @@ public class Controller implements IFloodlightProviderService,
...
@@ -1106,19 +1106,31 @@ public class Controller implements IFloodlightProviderService,
// Message handlers
// Message handlers
// ****************
// ****************
@LogMessageDocs
({
@LogMessageDoc
(
message
=
"Port modified on switch {switch}: {port} "
,
explanation
=
"Received notification from switch about port status change"
),
@LogMessageDoc
(
message
=
"Port added on switch {switch}: {port} "
,
explanation
=
"Received notification from switch about a new port addition"
),
@LogMessageDoc
(
message
=
"Port deleted on switch {switch}: port_no = {port} "
,
explanation
=
"Received notification from switch about a port removal"
),
@LogMessageDoc
(
level
=
"ERROR"
,
message
=
"Failure adding update to queue"
,
explanation
=
"Failed to add port status change to internal queue for processing"
,
recommendation
=
LogMessageDoc
.
REPORT_CONTROLLER_BUG
)
})
protected
void
handlePortStatusMessage
(
IOFSwitch
sw
,
OFPortStatus
m
)
{
protected
void
handlePortStatusMessage
(
IOFSwitch
sw
,
OFPortStatus
m
)
{
short
portNumber
=
m
.
getDesc
().
getPortNumber
();
short
portNumber
=
m
.
getDesc
().
getPortNumber
();
OFPhysicalPort
port
=
m
.
getDesc
();
OFPhysicalPort
port
=
m
.
getDesc
();
if
(
m
.
getReason
()
==
(
byte
)
OFPortReason
.
OFPPR_MODIFY
.
ordinal
())
{
if
(
m
.
getReason
()
==
(
byte
)
OFPortReason
.
OFPPR_MODIFY
.
ordinal
())
{
sw
.
setPort
(
port
);
sw
.
setPort
(
port
);
log
.
debug
(
"Port
#{}
modified
for {}"
,
portNumber
,
sw
);
log
.
info
(
"Port modified
on switch {}: {}"
,
sw
,
port
);
}
else
if
(
m
.
getReason
()
==
(
byte
)
OFPortReason
.
OFPPR_ADD
.
ordinal
())
{
}
else
if
(
m
.
getReason
()
==
(
byte
)
OFPortReason
.
OFPPR_ADD
.
ordinal
())
{
sw
.
setPort
(
port
);
sw
.
setPort
(
port
);
log
.
debug
(
"Port
#{}
added
for {}"
,
portNumber
,
sw
);
log
.
info
(
"Port added
on switch {}: {}"
,
sw
,
port
);
}
else
if
(
m
.
getReason
()
==
}
else
if
(
m
.
getReason
()
==
(
byte
)
OFPortReason
.
OFPPR_DELETE
.
ordinal
())
{
(
byte
)
OFPortReason
.
OFPPR_DELETE
.
ordinal
())
{
sw
.
deletePort
(
portNumber
);
sw
.
deletePort
(
portNumber
);
log
.
debug
(
"Port
#{}
deleted
for {}"
,
portNumber
,
sw
);
log
.
info
(
"Port deleted
on switch {}: port_no = {}"
,
sw
,
portNumber
);
}
}
SwitchUpdate
update
=
new
SwitchUpdate
(
sw
,
SwitchUpdateType
.
PORTCHANGED
);
SwitchUpdate
update
=
new
SwitchUpdate
(
sw
,
SwitchUpdateType
.
PORTCHANGED
);
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/org/openflow/protocol/OFPhysicalPort.java
+
34
−
2
View file @
1722663a
...
@@ -26,14 +26,15 @@ import net.floodlightcontroller.core.web.serializers.UShortSerializer;
...
@@ -26,14 +26,15 @@ import net.floodlightcontroller.core.web.serializers.UShortSerializer;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.jboss.netty.buffer.ChannelBuffer
;
import
org.jboss.netty.buffer.ChannelBuffer
;
import
org.openflow.util.HexString
;
/**
/**
* Represents ofp_phy_port
* Represents ofp_phy_port
* @author David Erickson (daviderickson@cs.stanford.edu) - Mar 25, 2010
* @author David Erickson (daviderickson@cs.stanford.edu) - Mar 25, 2010
*/
*/
public
class
OFPhysicalPort
{
public
class
OFPhysicalPort
{
public
static
int
MINIMUM_LENGTH
=
48
;
public
final
static
int
MINIMUM_LENGTH
=
48
;
public
static
int
OFP_ETH_ALEN
=
6
;
public
final
static
int
OFP_ETH_ALEN
=
6
;
public
enum
OFPortConfig
{
public
enum
OFPortConfig
{
OFPPC_PORT_DOWN
(
1
<<
0
)
{
OFPPC_PORT_DOWN
(
1
<<
0
)
{
...
@@ -467,4 +468,35 @@ public class OFPhysicalPort {
...
@@ -467,4 +468,35 @@ public class OFPhysicalPort {
}
}
return
true
;
return
true
;
}
}
@Override
public
String
toString
()
{
String
linkState
,
linkSpeed
;
if
((
state
&
OFPortState
.
OFPPS_LINK_DOWN
.
getValue
())
!=
0
)
{
linkState
=
"down"
;
}
else
{
linkState
=
"up"
;
}
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_10GB_FD
.
getValue
())
!=
0
)
{
linkSpeed
=
"10G"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_1GB_FD
.
getValue
())
!=
0
)
{
linkSpeed
=
"1G"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_1GB_HD
.
getValue
())
!=
0
)
{
linkSpeed
=
"1G(half-duplex)"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_100MB_FD
.
getValue
())
!=
0
)
{
linkSpeed
=
"100M"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_100MB_HD
.
getValue
())
!=
0
)
{
linkSpeed
=
"100M(half-duplex)"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_10MB_FD
.
getValue
())
!=
0
)
{
linkSpeed
=
"10M"
;
}
else
if
((
currentFeatures
&
OFPortFeatures
.
OFPPF_10MB_HD
.
getValue
())
!=
0
)
{
linkSpeed
=
"10M(half-duplex)"
;
}
else
{
linkSpeed
=
"unknown"
;
}
return
"port "
+
name
+
" ("
+
portNumber
+
")"
+
", mac "
+
HexString
.
toHexString
(
hardwareAddress
)
+
", state "
+
linkState
+
", speed "
+
linkSpeed
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment