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);
}
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());
}
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));
}
Aggregations