Search in sources :

Example 56 with LinkKey

use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.

the class SimpleLinkStoreTest method testNonDurableToDurable.

@Test
public void testNonDurableToDurable() {
    final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
    final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
    LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2);
    putLink(linkId1, DIRECT, A1);
    assertFalse("should not be durable", linkStore.getLink(d1P1, d2P2).isExpected());
    putLink(linkId1, DIRECT, DA1);
    assertTrue("should be durable", linkStore.getLink(d1P1, d2P2).isExpected());
}
Also used : LinkKey(org.onosproject.net.LinkKey) ConnectPoint(org.onosproject.net.ConnectPoint) Test(org.junit.Test)

Example 57 with LinkKey

use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.

the class OplinkOpticalProtectionSwitchConfig method addLink.

private void addLink(DeviceId peerId) {
    if (peerId == null) {
        log.warn("PeerID is null for device {}", data().deviceId());
        return;
    }
    LinkKey link = linkKey(new ConnectPoint(peerId, PORT_VIRTUAL), new ConnectPoint(data().deviceId(), PORT_VIRTUAL));
    handler().get(NetworkConfigService.class).addConfig(link, BasicLinkConfig.class).type(Link.Type.VIRTUAL).apply();
}
Also used : LinkKey(org.onosproject.net.LinkKey) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 58 with LinkKey

use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.

the class OplinkOpticalProtectionSwitchConfig method removeLink.

private void removeLink(DeviceId peerId) {
    if (peerId == null) {
        log.warn("PeerID is null for device {}", data().deviceId());
        return;
    }
    LinkKey link = linkKey(new ConnectPoint(peerId, PORT_VIRTUAL), new ConnectPoint(data().deviceId(), PORT_VIRTUAL));
    handler().get(NetworkConfigService.class).removeConfig(link, BasicLinkConfig.class);
}
Also used : LinkKey(org.onosproject.net.LinkKey) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 59 with LinkKey

use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.

the class OplinkSwitchProtection method removeLinkToPeer.

private void removeLinkToPeer(DeviceId peerId) {
    if (peerId == null) {
        log.warn("PeerID is null for device {}", data().deviceId());
        return;
    }
    ConnectPoint dstCp = new ConnectPoint(data().deviceId(), PortNumber.portNumber(VIRTUAL_PORT));
    ConnectPoint srcCp = new ConnectPoint(peerId, PortNumber.portNumber(VIRTUAL_PORT));
    LinkKey link = linkKey(srcCp, dstCp);
    handler().get(NetworkConfigService.class).removeConfig(link, BasicLinkConfig.class);
}
Also used : LinkKey(org.onosproject.net.LinkKey) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 60 with LinkKey

use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.

the class OplinkSwitchProtection method addLinkToPeer.

private void addLinkToPeer(DeviceId peerId) {
    if (peerId == null) {
        log.warn("PeerID is null for device {}", data().deviceId());
        return;
    }
    ConnectPoint dstCp = new ConnectPoint(data().deviceId(), PortNumber.portNumber(VIRTUAL_PORT));
    ConnectPoint srcCp = new ConnectPoint(peerId, PortNumber.portNumber(VIRTUAL_PORT));
    LinkKey link = linkKey(srcCp, dstCp);
    BasicLinkConfig cfg = handler().get(NetworkConfigService.class).addConfig(link, BasicLinkConfig.class);
    cfg.type(Link.Type.VIRTUAL);
    cfg.apply();
}
Also used : LinkKey(org.onosproject.net.LinkKey) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) ConnectPoint(org.onosproject.net.ConnectPoint) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) BasicLinkConfig(org.onosproject.net.config.basics.BasicLinkConfig)

Aggregations

LinkKey (org.onosproject.net.LinkKey)61 Test (org.junit.Test)34 ConnectPoint (org.onosproject.net.ConnectPoint)31 Link (org.onosproject.net.Link)23 Identifier (org.onlab.util.Identifier)14 DeviceId (org.onosproject.net.DeviceId)9 Set (java.util.Set)7 MplsLabel (org.onlab.packet.MplsLabel)7 VlanId (org.onlab.packet.VlanId)7 LinkDescription (org.onosproject.net.link.LinkDescription)7 LinkEvent (org.onosproject.net.link.LinkEvent)7 DefaultLinkDescription (org.onosproject.net.link.DefaultLinkDescription)6 ProviderId (org.onosproject.net.provider.ProviderId)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 FirstFitSelection (org.onosproject.net.resource.impl.LabelAllocator.FirstFitSelection)5 RandomSelection (org.onosproject.net.resource.impl.LabelAllocator.RandomSelection)5 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)4 NetworkConfigService (org.onosproject.net.config.NetworkConfigService)4 BasicLinkConfig (org.onosproject.net.config.basics.BasicLinkConfig)4