use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.
the class OplinkSwitchProtection method getActiveIndex.
/*
* get active path index
*/
private int getActiveIndex(List<TransportEndpointState> pathStates) {
long activePort = (long) getActivePort();
int activeIndex = 0;
for (TransportEndpointState state : pathStates) {
if (state.description().output().connectPoint().port().toLong() == activePort) {
return activeIndex;
}
++activeIndex;
}
return ProtectedTransportEndpointState.ACTIVE_UNKNOWN;
}
use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.
the class OplinkSwitchProtection method getProtectedTransportEndpointDescription.
/*
* return the protected endpoint description of this devices
*/
private ProtectedTransportEndpointDescription getProtectedTransportEndpointDescription() {
List<TransportEndpointDescription> teds = new ArrayList<>();
FilteredConnectPoint fcpPrimary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), PortNumber.portNumber(PRIMARY_PORT)));
FilteredConnectPoint fcpSecondary = new FilteredConnectPoint(new ConnectPoint(data().deviceId(), PortNumber.portNumber(SECONDARY_PORT)));
TransportEndpointDescription tedPrimary = TransportEndpointDescription.builder().withOutput(fcpPrimary).build();
TransportEndpointDescription tedSecondary = TransportEndpointDescription.builder().withOutput(fcpSecondary).build();
teds.add(tedPrimary);
teds.add(tedSecondary);
return ProtectedTransportEndpointDescription.of(teds, getPeerId(), OPLINK_FINGERPRINT);
}
use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.
the class OplinkSwitchProtection method getPeerId.
private DeviceId getPeerId() {
ConnectPoint dstCp = new ConnectPoint(data().deviceId(), PortNumber.portNumber(VIRTUAL_PORT));
Set<Link> links = handler().get(LinkService.class).getIngressLinks(dstCp);
for (Link l : links) {
if (l.type() == Link.Type.VIRTUAL) {
// this device is the destination and peer is the source.
return l.src().deviceId();
}
}
return data().deviceId();
}
use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.
the class OFSwitchManager method neighbour.
@Override
public ConnectPoint neighbour(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) {
ConnectPoint cp = new ConnectPoint(deviceId, portNumber);
LinkService linkService = virtualNetService.get(networkId, LinkService.class);
Set<Link> links = linkService.getEgressLinks(cp);
log.trace("neighbour cp {} egressLinks {}", cp, links);
if (links != null && links.size() > 0) {
Link link = links.iterator().next();
return link.src();
}
return null;
}
use of org.onosproject.net.ConnectPoint in project onos by opennetworkinglab.
the class ControlPlaneRedirectManagerTest method testAddDevice.
/**
* Tests adding new Device to a openflow router.
*/
@Test
public void testAddDevice() {
ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
List<InterfaceIpAddress> interfaceIpAddresses = new ArrayList<>();
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));
interfaceIpAddresses.add(new InterfaceIpAddress(IpAddress.valueOf("2000::ff"), IpPrefix.valueOf("2000::ff/120")));
Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses, MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
interfaces.add(sw1Eth4);
EasyMock.reset(flowObjectiveService);
setUpFlowObjectiveService();
deviceListener.event(new DeviceEvent(DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED, dev3));
verify(flowObjectiveService);
}
Aggregations