use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class TransportZoneNotificationUtil method shouldCreateVtep.
public boolean shouldCreateVtep(List<VpnInterfaces> vpnInterfaces) {
if (vpnInterfaces == null || vpnInterfaces.isEmpty()) {
return false;
}
for (VpnInterfaces vpnInterface : vpnInterfaces) {
String interfaceName = vpnInterface.getInterfaceName();
ElanInterface elanInt = elanService.getElanInterfaceByElanInterfaceName(interfaceName);
if (elanInt == null) {
continue;
}
if (ElanUtils.isVxlanNetworkOrVxlanSegment(elanInstanceCache.get(elanInt.getElanInstanceName()).orNull())) {
return true;
} else {
LOG.debug("Non-VXLAN elanInstance: {}", elanInt.getElanInstanceName());
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceTest method checkSMAC.
@Test
public void checkSMAC() throws Exception {
// Create Elan instance
createElanInstance(ExpectedObjects.ELAN1, ExpectedObjects.ELAN1_SEGMENT_ID);
awaitForElanTag(ExpectedObjects.ELAN1);
// Add Elan interface
InterfaceInfo interfaceInfo = ELAN_INTERFACES.get(ELAN1 + ":" + DPN1MAC1).getLeft();
addElanInterface(ExpectedObjects.ELAN1, interfaceInfo, DPN1IP1);
// Read Elan instance
InstanceIdentifier<ElanInstance> elanInstanceIid = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(ExpectedObjects.ELAN1)).build();
ElanInstance actualElanInstances = singleTxdataBroker.syncRead(CONFIGURATION, elanInstanceIid);
// Read and Compare SMAC flow
String flowId = new StringBuffer().append(NwConstants.ELAN_SMAC_TABLE).append(actualElanInstances.getElanTag()).append(DPN1_ID).append(interfaceInfo.getInterfaceTag()).append(interfaceInfo.getMacAddress()).toString();
InstanceIdentifier<Flow> flowInstanceIidSrc = getFlowIid(NwConstants.ELAN_SMAC_TABLE, new FlowId(flowId), DPN1_ID);
awaitForData(LogicalDatastoreType.CONFIGURATION, flowInstanceIidSrc);
Flow flowSrc = singleTxdataBroker.syncRead(CONFIGURATION, flowInstanceIidSrc);
flowSrc = getFlowWithoutCookie(flowSrc);
Flow expected = ExpectedObjects.checkSmac(flowId, interfaceInfo, actualElanInstances);
AssertDataObjects.assertEqualBeans(expected, flowSrc);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceTest method createElanInstanceAndInterfaceAndAttachEvpn.
public void createElanInstanceAndInterfaceAndAttachEvpn() throws ReadFailedException, TransactionCommitFailedException {
// Create Elan instance
createElanInstance(ExpectedObjects.ELAN1, ExpectedObjects.ELAN1_SEGMENT_ID);
awaitForElanTag(ExpectedObjects.ELAN1);
// Read Elan Instance
InstanceIdentifier<ElanInstance> elanInstanceIid = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(ExpectedObjects.ELAN1)).build();
ElanInstance elanInstance = singleTxdataBroker.syncRead(CONFIGURATION, elanInstanceIid);
// Add Elan interface
addElanInterface(ExpectedObjects.ELAN1, ELAN_INTERFACES.get(ELAN1 + ":" + DPN1MAC1).getLeft(), DPN1IP1);
// Attach EVPN to networks
evpnTestHelper.attachEvpnToNetwork(elanInstance);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceTestBase method createElanInstance.
protected void createElanInstance(String elan1, Long elan1SegmentId) {
ElanInstance elanInstance = ExpectedObjects.createElanInstance(elan1, elan1SegmentId);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elan1), elanInstance);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class EvpnTestHelper method updateEvpnNameInElan.
public void updateEvpnNameInElan(String elanInstanceName, String evpnName) throws ReadFailedException, TransactionCommitFailedException {
InstanceIdentifier<ElanInstance> elanIid = ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName);
ElanInstance elanInstance = singleTxdataBroker.syncRead(LogicalDatastoreType.CONFIGURATION, elanIid);
EvpnAugmentationBuilder evpnAugmentationBuilder = new EvpnAugmentationBuilder();
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder(elanInstance);
evpnAugmentationBuilder.setEvpnName(evpnName);
LOG.debug("Writing Elan-EvpnAugmentation evpnName {} with key {}", evpnName, elanInstanceName);
elanInstanceBuilder.addAugmentation(EvpnAugmentation.class, evpnAugmentationBuilder.build());
singleTxdataBroker.syncWrite(LogicalDatastoreType.CONFIGURATION, elanIid, elanInstanceBuilder.build());
}
Aggregations