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
ae6b1df6
Commit
ae6b1df6
authored
11 years ago
by
Vishnu Emmadi
Browse files
Options
Downloads
Patches
Plain Diff
added topology events
parent
b6aa52a0
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/topology/TopologyManager.java
+95
-3
95 additions, 3 deletions
...va/net/floodlightcontroller/topology/TopologyManager.java
with
95 additions
and
3 deletions
src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+
95
−
3
View file @
ae6b1df6
...
@@ -51,6 +51,13 @@ import net.floodlightcontroller.debugcounter.IDebugCounterService;
...
@@ -51,6 +51,13 @@ import net.floodlightcontroller.debugcounter.IDebugCounterService;
import
net.floodlightcontroller.debugcounter.IDebugCounterService.CounterException
;
import
net.floodlightcontroller.debugcounter.IDebugCounterService.CounterException
;
import
net.floodlightcontroller.debugcounter.IDebugCounterService.CounterType
;
import
net.floodlightcontroller.debugcounter.IDebugCounterService.CounterType
;
import
net.floodlightcontroller.debugcounter.NullDebugCounter
;
import
net.floodlightcontroller.debugcounter.NullDebugCounter
;
import
net.floodlightcontroller.debugevent.IDebugEventService
;
import
net.floodlightcontroller.debugevent.IEventUpdater
;
import
net.floodlightcontroller.debugevent.NullDebugEvent
;
import
net.floodlightcontroller.debugevent.IDebugEventService.EventColumn
;
import
net.floodlightcontroller.debugevent.IDebugEventService.EventFieldType
;
import
net.floodlightcontroller.debugevent.IDebugEventService.EventType
;
import
net.floodlightcontroller.debugevent.IDebugEventService.MaxEventsRegistered
;
import
net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener
;
import
net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener
;
import
net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService
;
import
net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService
;
import
net.floodlightcontroller.packet.BSN
;
import
net.floodlightcontroller.packet.BSN
;
...
@@ -164,6 +171,65 @@ public class TopologyManager implements
...
@@ -164,6 +171,65 @@ public class TopologyManager implements
protected
static
final
String
PACKAGE
=
TopologyManager
.
class
.
getPackage
().
getName
();
protected
static
final
String
PACKAGE
=
TopologyManager
.
class
.
getPackage
().
getName
();
protected
IDebugCounter
ctrIncoming
;
protected
IDebugCounter
ctrIncoming
;
/**
* Debug Events
*/
protected
IDebugEventService
debugEvents
;
/*
* Topology Event Updater
*/
protected
IEventUpdater
<
TopologyEvent
>
evTopology
;
/**
* Topology Information exposed for a Topology related event - used inside
* the BigTopologyEvent class
*/
protected
class
TopologyEventInfo
{
private
final
int
numOpenflowClusters
;
private
final
int
numExternalClusters
;
private
final
int
numExternalPorts
;
private
final
int
numTunnelPorts
;
public
TopologyEventInfo
(
int
numOpenflowClusters
,
int
numExternalClusters
,
int
numExternalPorts
,
int
numTunnelPorts
)
{
super
();
this
.
numOpenflowClusters
=
numOpenflowClusters
;
this
.
numExternalClusters
=
numExternalClusters
;
this
.
numExternalPorts
=
numExternalPorts
;
this
.
numTunnelPorts
=
numTunnelPorts
;
}
@Override
public
String
toString
()
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"# Openflow Clusters: "
);
builder
.
append
(
numOpenflowClusters
);
builder
.
append
(
", # External Clusters: "
);
builder
.
append
(
numExternalClusters
);
builder
.
append
(
", # External Ports: "
);
builder
.
append
(
numExternalPorts
);
builder
.
append
(
", # Tunnel Ports: "
);
builder
.
append
(
numTunnelPorts
);
return
builder
.
toString
();
}
}
/**
* Topology Event class to track topology related events
*/
protected
class
TopologyEvent
{
@EventColumn
(
name
=
"Reason"
,
description
=
EventFieldType
.
STRING
)
private
final
String
reason
;
@EventColumn
(
name
=
"Topology Summary"
)
private
final
TopologyEventInfo
topologyInfo
;
public
TopologyEvent
(
String
reason
,
TopologyEventInfo
topologyInfo
)
{
super
();
this
.
reason
=
reason
;
this
.
topologyInfo
=
topologyInfo
;
}
}
// Getter/Setter methods
// Getter/Setter methods
/**
/**
* Get the time interval for the period topology updates, if any.
* Get the time interval for the period topology updates, if any.
...
@@ -221,7 +287,7 @@ public class TopologyManager implements
...
@@ -221,7 +287,7 @@ public class TopologyManager implements
dtLinksUpdated
=
false
;
dtLinksUpdated
=
false
;
tunnelPortsUpdated
=
false
;
tunnelPortsUpdated
=
false
;
List
<
LDUpdate
>
appliedUpdates
=
applyUpdates
();
List
<
LDUpdate
>
appliedUpdates
=
applyUpdates
();
newInstanceFlag
=
createNewInstance
();
newInstanceFlag
=
createNewInstance
(
"link-discovery-updates"
);
lastUpdateTime
=
new
Date
();
lastUpdateTime
=
new
Date
();
informListeners
(
appliedUpdates
);
informListeners
(
appliedUpdates
);
return
newInstanceFlag
;
return
newInstanceFlag
;
...
@@ -762,6 +828,7 @@ public class TopologyManager implements
...
@@ -762,6 +828,7 @@ public class TopologyManager implements
context
.
getServiceImpl
(
IFloodlightProviderService
.
class
);
context
.
getServiceImpl
(
IFloodlightProviderService
.
class
);
restApi
=
context
.
getServiceImpl
(
IRestApiService
.
class
);
restApi
=
context
.
getServiceImpl
(
IRestApiService
.
class
);
debugCounters
=
context
.
getServiceImpl
(
IDebugCounterService
.
class
);
debugCounters
=
context
.
getServiceImpl
(
IDebugCounterService
.
class
);
debugEvents
=
context
.
getServiceImpl
(
IDebugEventService
.
class
);
switchPorts
=
new
HashMap
<
Long
,
Set
<
Short
>>();
switchPorts
=
new
HashMap
<
Long
,
Set
<
Short
>>();
switchPortLinks
=
new
HashMap
<
NodePortTuple
,
Set
<
Link
>>();
switchPortLinks
=
new
HashMap
<
NodePortTuple
,
Set
<
Link
>>();
...
@@ -772,6 +839,22 @@ public class TopologyManager implements
...
@@ -772,6 +839,22 @@ public class TopologyManager implements
ldUpdates
=
new
LinkedBlockingQueue
<
LDUpdate
>();
ldUpdates
=
new
LinkedBlockingQueue
<
LDUpdate
>();
haListener
=
new
HAListenerDelegate
();
haListener
=
new
HAListenerDelegate
();
registerTopologyDebugCounters
();
registerTopologyDebugCounters
();
registerTopologyDebugEvents
();
}
protected
void
registerTopologyDebugEvents
()
throws
FloodlightModuleException
{
if
(
debugEvents
==
null
)
{
debugEvents
=
new
NullDebugEvent
();
}
try
{
evTopology
=
debugEvents
.
registerEvent
(
PACKAGE
,
"topologyevent"
,
"Topology Computation"
,
EventType
.
ALWAYS_LOG
,
TopologyEvent
.
class
,
100
);
}
catch
(
MaxEventsRegistered
e
)
{
throw
new
FloodlightModuleException
(
"Max events registered"
,
e
);
}
}
}
@Override
@Override
...
@@ -1084,13 +1167,17 @@ public class TopologyManager implements
...
@@ -1084,13 +1167,17 @@ public class TopologyManager implements
tunnelPortsUpdated
=
true
;
tunnelPortsUpdated
=
true
;
}
}
public
boolean
createNewInstance
()
{
return
createNewInstance
(
"internal"
);
}
/**
/**
* This function computes a new topology instance.
* This function computes a new topology instance.
* It ignores links connected to all broadcast domain ports
* It ignores links connected to all broadcast domain ports
* and tunnel ports. The method returns if a new instance of
* and tunnel ports. The method returns if a new instance of
* topology was created or not.
* topology was created or not.
*/
*/
protected
boolean
createNewInstance
()
{
protected
boolean
createNewInstance
(
String
reason
)
{
Set
<
NodePortTuple
>
blockedPorts
=
new
HashSet
<
NodePortTuple
>();
Set
<
NodePortTuple
>
blockedPorts
=
new
HashSet
<
NodePortTuple
>();
if
(!
linksUpdated
)
return
false
;
if
(!
linksUpdated
)
return
false
;
...
@@ -1140,6 +1227,11 @@ public class TopologyManager implements
...
@@ -1140,6 +1227,11 @@ public class TopologyManager implements
// If needed, we may compute them differently.
// If needed, we may compute them differently.
currentInstance
=
nt
;
currentInstance
=
nt
;
currentInstanceWithoutTunnels
=
nt
;
currentInstanceWithoutTunnels
=
nt
;
TopologyEventInfo
topologyInfo
=
new
TopologyEventInfo
(
nt
.
getClusters
().
size
(),
0
,
0
,
0
);
evTopology
.
updateEventWithFlush
(
new
TopologyEvent
(
reason
,
topologyInfo
));
return
true
;
return
true
;
}
}
...
@@ -1388,7 +1480,7 @@ public class TopologyManager implements
...
@@ -1388,7 +1480,7 @@ public class TopologyManager implements
linksUpdated
=
true
;
linksUpdated
=
true
;
dtLinksUpdated
=
true
;
dtLinksUpdated
=
true
;
tunnelPortsUpdated
=
true
;
tunnelPortsUpdated
=
true
;
createNewInstance
();
createNewInstance
(
"startup"
);
lastUpdateTime
=
new
Date
();
lastUpdateTime
=
new
Date
();
}
}
...
...
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