Search in sources :

Example 71 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsCommandTest method testSetEncap.

/**
 * Sets encapsulation to a VPLS.
 */
@Test
public void testSetEncap() {
    ((TestVpls) vplsCommand.vpls).initSampleData();
    // Sets to NONE
    vplsCommand.command = VplsCommandEnum.SET_ENCAP.toString();
    vplsCommand.vplsName = VPLS1;
    vplsCommand.optArg = EncapsulationType.NONE.name();
    vplsCommand.doExecute();
    VplsData result = vplsCommand.vpls.getVpls(VPLS1);
    assertEquals(result.encapsulationType(), EncapsulationType.NONE);
    // Sets to VLAN
    vplsCommand.command = VplsCommandEnum.SET_ENCAP.toString();
    vplsCommand.vplsName = VPLS1;
    vplsCommand.optArg = EncapsulationType.VLAN.name();
    vplsCommand.doExecute();
    result = vplsCommand.vpls.getVpls(VPLS1);
    assertEquals(result.encapsulationType(), EncapsulationType.VLAN);
    // Sets to MPLS
    vplsCommand.command = VplsCommandEnum.SET_ENCAP.toString();
    vplsCommand.vplsName = VPLS1;
    vplsCommand.optArg = EncapsulationType.MPLS.name();
    vplsCommand.doExecute();
    result = vplsCommand.vpls.getVpls(VPLS1);
    assertEquals(result.encapsulationType(), EncapsulationType.MPLS);
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) VplsTest(org.onosproject.vpls.VplsTest) Test(org.junit.Test)

Example 72 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsConfigManagerTest method testReloadNullConfig.

/**
 * Sends a network config event with null network config.
 */
@Test
public void testReloadNullConfig() {
    ((TestConfigService) vplsConfigManager.configService).setConfig(null);
    NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, null, VplsAppConfig.class);
    ((TestConfigService) vplsConfigManager.configService).sendEvent(event);
    Collection<VplsData> vplss = vplsConfigManager.vpls.getAllVpls();
    assertEquals(0, vplss.size());
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) VplsData(org.onosproject.vpls.api.VplsData) VplsTest(org.onosproject.vpls.VplsTest) Test(org.junit.Test)

Example 73 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsConfigManagerTest method testReloadConfig.

/**
 * Reloads network configuration by sending a network config event.
 */
@Test
public void testReloadConfig() {
    NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, null, VplsAppConfig.class);
    ((TestConfigService) vplsConfigManager.configService).sendEvent(event);
    Collection<VplsData> vplss = vplsConfigManager.vpls.getAllVpls();
    assertEquals(2, vplss.size());
    VplsData expect = VplsData.of(VPLS1);
    expect.addInterfaces(ImmutableSet.of(V100H1, V100H2));
    expect.state(VplsData.VplsState.ADDED);
    assertTrue(vplss.contains(expect));
    expect = VplsData.of(VPLS2, EncapsulationType.VLAN);
    expect.addInterfaces(ImmutableSet.of(V200H1, V200H2));
    expect.state(VplsData.VplsState.ADDED);
    System.out.println(vplss);
    assertTrue(vplss.contains(expect));
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) VplsData(org.onosproject.vpls.api.VplsData) VplsTest(org.onosproject.vpls.VplsTest) Test(org.junit.Test)

Aggregations

VplsData (org.onosproject.vpls.api.VplsData)73 Test (org.junit.Test)44 VplsOperation (org.onosproject.vpls.api.VplsOperation)18 VplsTest (org.onosproject.vpls.VplsTest)11 ArrayDeque (java.util.ArrayDeque)10 Interface (org.onosproject.net.intf.Interface)10 Vpls (org.onosproject.vpls.api.Vpls)7 NetworkConfigEvent (org.onosproject.net.config.NetworkConfigEvent)6 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Host (org.onosproject.net.Host)4 HostEvent (org.onosproject.net.host.HostEvent)4 Intent (org.onosproject.net.intent.Intent)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Objects (java.util.Objects)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 MacAddress (org.onlab.packet.MacAddress)3