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
8d98de65
Commit
8d98de65
authored
12 years ago
by
Sho SHIMIZU
Browse files
Options
Downloads
Patches
Plain Diff
Remove use of magic numbers for the values of length
parent
7ccc6b22
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/internal/LinkDiscoveryManager.java
+6
-5
6 additions, 5 deletions
...ntroller/linkdiscovery/internal/LinkDiscoveryManager.java
with
6 additions
and
5 deletions
src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+
6
−
5
View file @
8d98de65
...
...
@@ -276,13 +276,14 @@ public class LinkDiscoveryManager
ethernet
.
setPayload
(
lldp
);
byte
[]
chassisId
=
new
byte
[]
{
4
,
0
,
0
,
0
,
0
,
0
,
0
};
// filled in later
byte
[]
portId
=
new
byte
[]
{
2
,
0
,
0
};
// filled in later
lldp
.
setChassisId
(
new
LLDPTLV
().
setType
((
byte
)
1
).
setLength
((
short
)
7
).
setValue
(
chassisId
));
lldp
.
setPortId
(
new
LLDPTLV
().
setType
((
byte
)
2
).
setLength
((
short
)
3
).
setValue
(
portId
));
lldp
.
setTtl
(
new
LLDPTLV
().
setType
((
byte
)
3
).
setLength
((
short
)
2
).
setValue
(
new
byte
[]
{
0
,
0x78
}));
byte
[]
ttlValue
=
new
byte
[]
{
0
,
0x78
};
lldp
.
setChassisId
(
new
LLDPTLV
().
setType
((
byte
)
1
).
setLength
((
short
)
chassisId
.
length
).
setValue
(
chassisId
));
lldp
.
setPortId
(
new
LLDPTLV
().
setType
((
byte
)
2
).
setLength
((
short
)
portId
.
length
).
setValue
(
portId
));
lldp
.
setTtl
(
new
LLDPTLV
().
setType
((
byte
)
3
).
setLength
((
short
)
ttlValue
.
length
).
setValue
(
ttlValue
));
// OpenFlow OUI - 00-26-E1
byte
[]
dpidTLVValue
=
new
byte
[]
{
0x0
,
0x26
,
(
byte
)
0xe1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
LLDPTLV
dpidTLV
=
new
LLDPTLV
().
setType
((
byte
)
127
).
setLength
((
short
)
12
).
setValue
(
dpidTLVValue
);
LLDPTLV
dpidTLV
=
new
LLDPTLV
().
setType
((
byte
)
127
).
setLength
((
short
)
dpidTLVValue
.
length
).
setValue
(
dpidTLVValue
);
lldp
.
getOptionalTLVList
().
add
(
dpidTLV
);
// Add the controller identifier to the TLV value.
...
...
@@ -408,7 +409,7 @@ public class LinkDiscoveryManager
bb
.
rewind
();
bb
.
get
(
controllerTLVValue
,
0
,
8
);
this
.
controllerTLV
=
new
LLDPTLV
().
setType
((
byte
)
0x0c
).
setLength
((
short
)
8
).
setValue
(
controllerTLVValue
);
this
.
controllerTLV
=
new
LLDPTLV
().
setType
((
byte
)
0x0c
).
setLength
((
short
)
controllerTLVValue
.
length
).
setValue
(
controllerTLVValue
);
}
@Override
...
...
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