Search in sources :

Example 1 with ElanToPseudoPortDataKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataKey in project netvirt by opendaylight.

the class ElanServiceChainUtils method updateElanToLportTagMap.

/**
 * Stores the relation between ElanLport and scfTag.
 *
 * @param broker dataBroker service reference
 * @param elanInstanceName Name of the ELAN. Typically its UUID
 * @param lportTag Dataplane identifier of the ElanPseudoPort
 * @param scfTag Dataplane identifier of the SCF
 * @param addOrRemove States if flows must be added or removed
 */
public static void updateElanToLportTagMap(final DataBroker broker, final String elanInstanceName, final int lportTag, final long scfTag, final int addOrRemove) {
    Long portTag = Long.valueOf(lportTag);
    ElanToPseudoPortDataKey key = new ElanToPseudoPortDataKey(portTag, scfTag);
    InstanceIdentifier<ElanToPseudoPortData> path = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).augmentation(ElanServiceChainState.class).child(ElanToPseudoPortData.class, key).build();
    if (addOrRemove == NwConstants.ADD_FLOW) {
        ElanToPseudoPortData newValue = new ElanToPseudoPortDataBuilder().setKey(key).setElanLportTag(portTag).setScfTag(scfTag).build();
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, path, newValue);
    } else {
        MDSALUtil.syncDelete(broker, LogicalDatastoreType.CONFIGURATION, path);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanToPseudoPortDataKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataKey) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanToPseudoPortDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataBuilder) ElanToPseudoPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData)

Aggregations

ElanToPseudoPortData (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData)1 ElanToPseudoPortDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataBuilder)1 ElanToPseudoPortDataKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataKey)1 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)1 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)1