Search in sources :

Example 6 with ElanInstanceBuilder

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();
}
Also used : ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 7 with ElanInstanceBuilder

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());
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EvpnAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentationBuilder) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 8 with ElanInstanceBuilder

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);
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 9 with ElanInstanceBuilder

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();
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) EvpnAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentationBuilder) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder) ReadWriteTransaction(org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction) EvpnAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentation)

Example 10 with ElanInstanceBuilder

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;
}
Also used : ElanSegments(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ElanSegments) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Aggregations

ElanInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)10 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)8 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)4 EvpnAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentationBuilder)3 EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)2 EtreeInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder)2 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 EtreeLeafTag (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTag)1 EtreeLeafTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)1 EtreeLeafTagNameBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagNameBuilder)1 EvpnAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentation)1 MacTable (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTable)1 MacTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableBuilder)1 MacTableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey)1 ElanSegments (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ElanSegments)1 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)1 ElanBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder)1 ElanKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanKey)1 ElanTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName)1