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
5edc2625
Commit
5edc2625
authored
8 years ago
by
Ryan Izard
Browse files
Options
Downloads
Patches
Plain Diff
Include OpenFlow version in /wm/core/controller/switches/json REST API output
parent
a80bd58f
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/core/web/ControllerSwitchesResource.java
+17
-8
17 additions, 8 deletions
...dlightcontroller/core/web/ControllerSwitchesResource.java
with
17 additions
and
8 deletions
src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
+
17
−
8
View file @
5edc2625
...
...
@@ -23,6 +23,7 @@ import java.util.HashSet;
import
net.floodlightcontroller.core.internal.IOFSwitchService
;
import
net.floodlightcontroller.core.IOFSwitch
;
import
org.projectfloodlight.openflow.protocol.OFVersion
;
import
org.projectfloodlight.openflow.types.DatapathId
;
import
org.restlet.resource.Get
;
import
org.restlet.resource.ServerResource
;
...
...
@@ -40,37 +41,45 @@ public class ControllerSwitchesResource extends ServerResource {
private
final
DatapathId
dpid
;
private
final
String
inetAddress
;
private
final
long
connectedSince
;
public
DatapathIDJsonSerializerWrapper
(
DatapathId
dpid
,
String
inetAddress
,
long
connectedSince
)
{
private
final
String
version
;
public
DatapathIDJsonSerializerWrapper
(
DatapathId
dpid
,
String
inetAddress
,
long
connectedSince
,
OFVersion
version
)
{
this
.
dpid
=
dpid
;
this
.
inetAddress
=
inetAddress
;
this
.
connectedSince
=
connectedSince
;
this
.
version
=
version
.
toString
();
}
@JsonSerialize
(
using
=
DPIDSerializer
.
class
)
public
DatapathId
getSwitchDPID
()
{
return
dpid
;
}
public
String
getInetAddress
()
{
return
inetAddress
;
}
public
long
getConnectedSince
()
{
return
connectedSince
;
}
public
String
getOpenFlowVersion
()
{
return
version
;
}
}
@Get
(
"json"
)
public
Set
<
DatapathIDJsonSerializerWrapper
>
retrieve
(){
public
Set
<
DatapathIDJsonSerializerWrapper
>
retrieve
()
{
IOFSwitchService
switchService
=
(
IOFSwitchService
)
getContext
().
getAttributes
().
get
(
IOFSwitchService
.
class
.
getCanonicalName
());
Set
<
DatapathIDJsonSerializerWrapper
>
dpidSets
=
new
HashSet
<
DatapathIDJsonSerializerWrapper
>();
for
(
IOFSwitch
sw:
switchService
.
getAllSwitchMap
().
values
())
{
dpidSets
.
add
(
new
DatapathIDJsonSerializerWrapper
(
sw
.
getId
(),
sw
.
getInetAddress
().
toString
(),
sw
.
getConnectedSince
().
getTime
()));
for
(
IOFSwitch
sw:
switchService
.
getAllSwitchMap
().
values
())
{
dpidSets
.
add
(
new
DatapathIDJsonSerializerWrapper
(
sw
.
getId
(),
sw
.
getInetAddress
().
toString
(),
sw
.
getConnectedSince
().
getTime
(),
sw
.
getOFFactory
().
getVersion
()));
}
return
dpidSets
;
}
}
}
\ No newline at end of file
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