use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder in project netvirt by opendaylight.
the class CoeUtils method buildElanInstance.
static ElanInstance buildElanInstance(String elanInstanceName, Class<? extends SegmentTypeBase> segmentType, String segmentationId, Boolean isExternal) {
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName);
if (segmentType != null) {
elanInstanceBuilder.setSegmentType(segmentType);
if (segmentationId != null) {
elanInstanceBuilder.setSegmentationId(Long.valueOf(segmentationId));
}
}
elanInstanceBuilder.setExternal(isExternal);
elanInstanceBuilder.setKey(new ElanInstanceKey(elanInstanceName));
return elanInstanceBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder in project netvirt by opendaylight.
the class EvpnTestHelper method deleteEvpnNameInElan.
public void deleteEvpnNameInElan(String elanInstanceName) 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(null);
LOG.debug("deleting evpn name from Elan-EvpnAugmentation {} ", elanInstanceName);
elanInstanceBuilder.addAugmentation(EvpnAugmentation.class, evpnAugmentationBuilder.build());
singleTxdataBroker.syncWrite(LogicalDatastoreType.CONFIGURATION, elanIid, elanInstanceBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder in project netvirt by opendaylight.
the class AclServiceTestBase method newElan.
protected void newElan(String elanName, long elanId) throws TransactionCommitFailedException {
ElanInstance elan = new ElanInstanceBuilder().setElanInstanceName(elanName).setElanTag(5000L).build();
singleTransactionDataBroker.syncWrite(CONFIGURATION, AclServiceUtils.getElanInstanceConfigurationDataPath(elanName), elan);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder in project netvirt by opendaylight.
the class NeutronEvpnUtils method updateElanWithVpnInfo.
public void updateElanWithVpnInfo(String elanInstanceName, VpnInstance vpnInstance, Operation operation) {
String vpnName = vpnInstance.getVpnInstanceName();
InstanceIdentifier<ElanInstance> elanIid = ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName);
ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
Optional<ElanInstance> elanInstanceOptional = Optional.absent();
try {
elanInstanceOptional = transaction.read(LogicalDatastoreType.CONFIGURATION, elanIid).checkedGet();
} catch (ReadFailedException e) {
LOG.error("updateElanWithVpnInfo throws ReadFailedException e {}", e);
}
if (!elanInstanceOptional.isPresent()) {
return;
}
EvpnAugmentationBuilder evpnAugmentationBuilder = new EvpnAugmentationBuilder();
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder(elanInstanceOptional.get());
if (elanInstanceBuilder.getAugmentation(EvpnAugmentation.class) != null) {
evpnAugmentationBuilder = new EvpnAugmentationBuilder(elanInstanceBuilder.getAugmentation(EvpnAugmentation.class));
}
if (operation == Operation.ADD) {
evpnAugmentationBuilder.setEvpnName(vpnName);
LOG.debug("Writing Elan-EvpnAugmentation with key {}", elanInstanceName);
} else {
evpnAugmentationBuilder.setEvpnName(null);
LOG.debug("Deleting Elan-EvpnAugmentation with key {}", elanInstanceName);
}
elanInstanceBuilder.addAugmentation(EvpnAugmentation.class, evpnAugmentationBuilder.build());
transaction.put(LogicalDatastoreType.CONFIGURATION, elanIid, elanInstanceBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS);
transaction.submit();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder in project netvirt by opendaylight.
the class NeutronNetworkChangeListener method createElanInstanceBuilder.
private ElanInstanceBuilder createElanInstanceBuilder(String elanInstanceName, Class<? extends SegmentTypeBase> segmentType, String segmentationId, String physicalNetworkName, Network network) {
Boolean isExternal = NeutronvpnUtils.getIsExternal(network);
List<ElanSegments> segments = buildSegments(network);
ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName);
if (segmentType != null) {
elanInstanceBuilder.setSegmentType(segmentType);
if (segmentationId != null) {
elanInstanceBuilder.setSegmentationId(Long.valueOf(segmentationId));
}
if (physicalNetworkName != null) {
elanInstanceBuilder.setPhysicalNetworkName(physicalNetworkName);
}
}
elanInstanceBuilder.setElanSegments(segments);
elanInstanceBuilder.setExternal(isExternal);
elanInstanceBuilder.setKey(new ElanInstanceKey(elanInstanceName));
return elanInstanceBuilder;
}
Aggregations