Search in sources :

Example 1 with InterfaceEvent

use of org.onosproject.net.intf.InterfaceEvent in project onos by opennetworkinglab.

the class ControlPlaneRedirectManagerTest method testAddInterface.

/**
 * Tests adding while updating the networkConfig.
 */
@Test
public void testAddInterface() {
    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);
    expect(flowObjectiveService.allocateNextId()).andReturn(1).anyTimes();
    setUpInterfaceConfiguration(sw1Eth4, true);
    replay(flowObjectiveService);
    interfaceListener.event(new InterfaceEvent(InterfaceEvent.Type.INTERFACE_ADDED, sw1Eth4, 500L));
    verify(flowObjectiveService);
}
Also used : InterfaceEvent(org.onosproject.net.intf.InterfaceEvent) ArrayList(java.util.ArrayList) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Interface(org.onosproject.net.intf.Interface) Test(org.junit.Test)

Example 2 with InterfaceEvent

use of org.onosproject.net.intf.InterfaceEvent in project onos by opennetworkinglab.

the class SdnIpFibTest method testRemoveIngressInterface.

/**
 * Tests removing an existing interface.
 *
 * We first push an intent with destination sw3 and source sw1 and sw2. We
 * then remove the ingress interface on sw1.
 *
 * We verify that the synchronizer records the correct state and that the
 * correct intent is withdrawn from the IntentService.
 */
@Test
public void testRemoveIngressInterface() {
    // Add a route first
    testRouteAddToNoVlan();
    // Create the new expected intent
    MultiPointToSinglePointIntent remainingIntent = createIntentToThreeSrcTwo(PREFIX1);
    reset(intentSynchronizer);
    intentSynchronizer.submit(eqExceptId(remainingIntent));
    expectLastCall().once();
    replay(intentSynchronizer);
    // Define the existing ingress interface and remove it
    Interface intf = new Interface("sw1-eth1", SW1_ETH1, Collections.singletonList(IIP1), MAC1, VLAN10);
    InterfaceEvent intfEvent = new InterfaceEvent(InterfaceEvent.Type.INTERFACE_REMOVED, intf);
    interfaceListener.event(intfEvent);
    verify(intentSynchronizer);
}
Also used : InterfaceEvent(org.onosproject.net.intf.InterfaceEvent) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Interface(org.onosproject.net.intf.Interface) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Example 3 with InterfaceEvent

use of org.onosproject.net.intf.InterfaceEvent in project onos by opennetworkinglab.

the class ControlPlaneRedirectManagerTest method testRemoveInterface.

@Test
public void testRemoveInterface() {
    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);
    EasyMock.reset(flowObjectiveService);
    expect(flowObjectiveService.allocateNextId()).andReturn(1).anyTimes();
    setUpInterfaceConfiguration(sw1Eth4, false);
    replay(flowObjectiveService);
    interfaceListener.event(new InterfaceEvent(InterfaceEvent.Type.INTERFACE_REMOVED, sw1Eth4, 500L));
    verify(flowObjectiveService);
}
Also used : InterfaceEvent(org.onosproject.net.intf.InterfaceEvent) ArrayList(java.util.ArrayList) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Interface(org.onosproject.net.intf.Interface) Test(org.junit.Test)

Example 4 with InterfaceEvent

use of org.onosproject.net.intf.InterfaceEvent in project onos by opennetworkinglab.

the class SdnIpFibTest method testRemoveEgressInterface.

/**
 * Tests removing an existing egress interface.
 *
 * We first push an intent with destination sw3 and source sw1 and sw2. We
 * then remove the egress interface on sw3.
 *
 * We verify that the synchronizer records the correct state and that the
 * correct intent is withdrawn from the IntentService.
 */
@Test
public void testRemoveEgressInterface() {
    // Add a route first
    testRouteAddToNoVlan();
    // Create existing intent
    MultiPointToSinglePointIntent removedIntent = createIntentToThreeSrcOneTwo(PREFIX1);
    // Set up expectation
    reset(intentSynchronizer);
    // Setup the expected intents
    intentSynchronizer.withdraw(eqExceptId(removedIntent));
    replay(intentSynchronizer);
    // Define the existing egress interface and remove it
    Interface intf = new Interface("sw3-eth1", SW3_ETH1, Collections.singletonList(IIP3), MAC3, VlanId.NONE);
    InterfaceEvent intfEvent = new InterfaceEvent(InterfaceEvent.Type.INTERFACE_REMOVED, intf);
    interfaceListener.event(intfEvent);
    verify(intentSynchronizer);
}
Also used : InterfaceEvent(org.onosproject.net.intf.InterfaceEvent) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Interface(org.onosproject.net.intf.Interface) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Example 5 with InterfaceEvent

use of org.onosproject.net.intf.InterfaceEvent in project onos by opennetworkinglab.

the class SdnIpFibTest method testAddInterface.

/**
 * Tests adding a new interface.
 *
 * We verify that the synchronizer records the correct state and that the
 * correct intent is withdrawn from the IntentService.
 */
@Test
public void testAddInterface() {
    // Add a route first
    testRouteAddToNoVlan();
    // Create the new expected intent
    MultiPointToSinglePointIntent addedIntent = createIntentToThreeSrcOneTwoFour(PREFIX1);
    reset(intentSynchronizer);
    intentSynchronizer.submit(eqExceptId(addedIntent));
    expectLastCall().once();
    replay(intentSynchronizer);
    // Create the new interface and add notify it
    Interface intf = new Interface("sw4-eth1", SW4_ETH1, Collections.singletonList(IIP4), MAC4, NO_VLAN);
    InterfaceEvent intfEvent = new InterfaceEvent(InterfaceEvent.Type.INTERFACE_ADDED, intf);
    interfaceListener.event(intfEvent);
    verify(intentSynchronizer);
}
Also used : InterfaceEvent(org.onosproject.net.intf.InterfaceEvent) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Interface(org.onosproject.net.intf.Interface) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Aggregations

Test (org.junit.Test)5 Interface (org.onosproject.net.intf.Interface)5 InterfaceEvent (org.onosproject.net.intf.InterfaceEvent)5 AbstractIntentTest (org.onosproject.net.intent.AbstractIntentTest)3 MultiPointToSinglePointIntent (org.onosproject.net.intent.MultiPointToSinglePointIntent)3 ArrayList (java.util.ArrayList)2 ConnectPoint (org.onosproject.net.ConnectPoint)2 InterfaceIpAddress (org.onosproject.net.host.InterfaceIpAddress)2