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
b520756b
Commit
b520756b
authored
12 years ago
by
Shudong Zhou
Browse files
Options
Downloads
Patches
Plain Diff
Pretty print LDUpdate
parent
673c96dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
+41
-30
41 additions, 30 deletions
...et/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
with
41 additions
and
30 deletions
src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
+
41
−
30
View file @
b520756b
package
net.floodlightcontroller.linkdiscovery
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.ser.ToStringSerializer
;
import
org.openflow.util.HexString
;
public
interface
ILinkDiscovery
{
public
static
enum
UpdateOperation
{
LINK_UPDATED
,
LINK_REMOVED
,
SWITCH_UPDATED
,
SWITCH_REMOVED
,
PORT_UP
,
PORT_DOWN
};
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
public
enum
UpdateOperation
{
LINK_UPDATED
(
"Link Updated"
),
LINK_REMOVED
(
"Link Removed"
),
SWITCH_UPDATED
(
"Switch Updated"
),
SWITCH_REMOVED
(
"Switch Removed"
),
PORT_UP
(
"Port Up"
),
PORT_DOWN
(
"Port Down"
);
private
String
value
;
UpdateOperation
(
String
v
)
{
value
=
v
;
}
@Override
public
String
toString
()
{
return
value
;
}
}
public
class
LDUpdate
{
protected
long
src
;
...
...
@@ -83,36 +105,25 @@ public interface ILinkDiscovery {
@Override
public
String
toString
()
{
String
operationString
=
null
;
if
(
operation
==
UpdateOperation
.
LINK_REMOVED
)
{
operationString
=
"Link Removed"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
", srcPort="
+
srcPort
+
", dst="
+
dst
+
", dstPort="
+
dstPort
+
", type="
+
type
+
"]"
;
}
else
if
(
operation
==
UpdateOperation
.
LINK_UPDATED
)
{
operationString
=
"Link Updated"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
", srcPort="
+
srcPort
+
", dst="
+
dst
+
", dstPort="
+
dstPort
switch
(
operation
)
{
case
LINK_REMOVED:
case
LINK_UPDATED:
return
"LDUpdate [operation="
+
operation
+
", src="
+
HexString
.
toHexString
(
src
)
+
", srcPort="
+
srcPort
+
", dst="
+
HexString
.
toHexString
(
dst
)
+
", dstPort="
+
dstPort
+
", type="
+
type
+
"]"
;
}
else
if
(
operation
==
UpdateOperation
.
PORT_DOWN
)
{
operationString
=
"Port Down"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
", srcPort="
+
srcPort
+
"]"
;
}
else
if
(
operation
==
UpdateOperation
.
PORT_UP
)
{
operationString
=
"Port Up"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
", srcPort="
+
srcPort
+
"]"
;
}
else
if
(
operation
==
UpdateOperation
.
SWITCH_REMOVED
)
{
operationString
=
"Switch Removed"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
"]"
;
}
else
if
(
operation
==
UpdateOperation
.
SWITCH_UPDATED
)
{
operationString
=
"Switch Updated"
;
return
"LDUpdate [operation="
+
operationString
+
", src="
+
src
+
"]"
;
}
else
{
case
PORT_DOWN:
case
PORT_UP:
return
"LDUpdate [operation="
+
operation
+
", src="
+
HexString
.
toHexString
(
src
)
+
", srcPort="
+
srcPort
+
"]"
;
case
SWITCH_REMOVED:
case
SWITCH_UPDATED:
return
"LDUpdate [operation="
+
operation
+
", src="
+
HexString
.
toHexString
(
src
)
+
"]"
;
default
:
return
"LDUpdate: Unknown update."
;
}
}
...
...
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