use of org.projectfloodlight.openflow.protocol.OFExpExtAdId in project onos by opennetworkinglab.
the class OplinkHandshakerUtil method getNeighbor.
private OplinkPortAdjacency getNeighbor(OFExpPortAdjacency ad) {
// Check input parameter
if (ad == null) {
return null;
}
// Get adjacency properties
for (OFExpPortAdjacencyId adid : ad.getProperties()) {
List<OFExpExtAdId> otns = adid.getAdId();
if (otns != null && otns.size() > 0) {
OFExpPortAdidOtn otn = (OFExpPortAdidOtn) otns.get(0);
// ITU-T G.7714 ETH MAC Format (in second 16 bytes of the following)
// |---------------------------------------------------------------------------|
// | Other format (16 bytes) |
// |---------------------------------------------------------------------------|
// | Header (2 bytes) | ID (4 BITS) | MAC (6 bytes) | Port (4 bytes) | Unused |
// |---------------------------------------------------------------------------|
ByteBuf buffer = Unpooled.buffer(OPSPEC_BYTES);
otn.getOpspec().write32Bytes(buffer);
long mac = buffer.getLong(OPSPEC_MAC_POS) << OPSPEC_ID_BITS >>> OPSPEC_MAC_BIT_OFF;
int port = (int) (buffer.getLong(OPSPEC_PORT_POS) << OPSPEC_ID_BITS >>> OPSPEC_PORT_BIT_OFF);
// constructed from MAC address
return new OplinkPortAdjacency(DeviceId.deviceId(Dpid.uri(new Dpid(mac))), PortNumber.portNumber(port));
}
}
// Returns null if no properties found
return null;
}
Aggregations