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
c6ac712b
Commit
c6ac712b
authored
12 years ago
by
Rob Adams
Browse files
Options
Downloads
Patches
Plain Diff
Read port data from storage when switching to master state
parent
9149ffa5
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/internal/Controller.java
+51
-3
51 additions, 3 deletions
...va/net/floodlightcontroller/core/internal/Controller.java
with
51 additions
and
3 deletions
src/main/java/net/floodlightcontroller/core/internal/Controller.java
+
51
−
3
View file @
c6ac712b
...
...
@@ -826,14 +826,17 @@ public class Controller implements IFloodlightProviderService,
" list"
,
HexString
.
toHexString
(
sw
.
getId
()));
}
}
else
if
(!
isActive
)
{
// Some switches don't seem to update us with port
// status messages while in slave role.
readSwitchPortStateFromStorage
(
sw
);
addSwitch
(
sw
);
log
.
debug
(
"Added master switch {} to active switch list"
,
HexString
.
toHexString
(
sw
.
getId
()));
HexString
.
toHexString
(
sw
.
getId
()));
}
}
}
protected
boolean
handleVendorMessage
(
OFVendor
vendorMessage
)
{
protected
boolean
handleVendorMessage
(
OFVendor
vendorMessage
)
{
boolean
shouldHandleMessage
=
false
;
int
vendor
=
vendorMessage
.
getVendor
();
switch
(
vendor
)
{
...
...
@@ -1695,6 +1698,51 @@ public class Controller implements IFloodlightProviderService,
storageSource
.
updateRowAsync
(
PORT_TABLE_NAME
,
portInfo
);
}
/**
* Read switch port data from storage and write it into a switch object
* @param sw the switch to update
*/
protected
void
readSwitchPortStateFromStorage
(
OFSwitchImpl
sw
)
{
OperatorPredicate
op
=
new
OperatorPredicate
(
PORT_SWITCH
,
OperatorPredicate
.
Operator
.
EQ
,
sw
.
getStringId
());
IResultSet
portResultSet
=
storageSource
.
executeQuery
(
PORT_TABLE_NAME
,
null
,
op
,
null
);
Map
<
Short
,
OFPhysicalPort
>
oldports
=
new
HashMap
<
Short
,
OFPhysicalPort
>();
oldports
.
putAll
(
sw
.
getPorts
());
while
(
portResultSet
.
next
())
{
try
{
OFPhysicalPort
p
=
new
OFPhysicalPort
();
p
.
setPortNumber
((
short
)
portResultSet
.
getInt
(
PORT_NUMBER
));
p
.
setName
(
portResultSet
.
getString
(
PORT_NAME
));
p
.
setConfig
((
int
)
portResultSet
.
getLong
(
PORT_CONFIG
));
p
.
setState
((
int
)
portResultSet
.
getLong
(
PORT_STATE
));
String
portMac
=
portResultSet
.
getString
(
PORT_HARDWARE_ADDRESS
);
p
.
setHardwareAddress
(
HexString
.
fromHexString
(
portMac
));
p
.
setCurrentFeatures
((
int
)
portResultSet
.
getLong
(
PORT_CURRENT_FEATURES
));
p
.
setAdvertisedFeatures
((
int
)
portResultSet
.
getLong
(
PORT_ADVERTISED_FEATURES
));
p
.
setSupportedFeatures
((
int
)
portResultSet
.
getLong
(
PORT_SUPPORTED_FEATURES
));
p
.
setPeerFeatures
((
int
)
portResultSet
.
getLong
(
PORT_PEER_FEATURES
));
oldports
.
remove
(
Short
.
valueOf
(
p
.
getPortNumber
()));
sw
.
setPort
(
p
);
}
catch
(
NullPointerException
e
)
{
// ignore
}
}
for
(
Short
portNum
:
oldports
.
keySet
())
{
sw
.
deletePort
(
portNum
);
}
}
protected
void
removePortInfo
(
IOFSwitch
sw
,
short
portNumber
)
{
String
datapathIdString
=
sw
.
getStringId
();
String
id
=
datapathIdString
+
"|"
+
portNumber
;
...
...
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