use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class InterfaceManagerTestUtil method buildInterface.
static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
builder.addAugmentation(ParentRefs.class, parentRefs);
if (ifType.equals(L2vlan.class)) {
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
ifL2vlanBuilder.setVlanId(new VlanId(100));
} else {
ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
}
builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
} else if (ifType.equals(IfTunnel.class)) {
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
builder.addAugmentation(IfTunnel.class, tunnel);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class InterfaceManagerTestUtil method putVlanInterfaceConfig.
static void putVlanInterfaceConfig(DataBroker dataBroker, String ifaceName, String parentRefs, IfL2vlan.L2vlanMode l2vlanMode) throws TransactionCommitFailedException {
Interface interfaceInfo = InterfaceManagerTestUtil.buildInterface(ifaceName, ifaceName, true, L2vlan.class, parentRefs, l2vlanMode);
InstanceIdentifier<Interface> interfaceInstanceIdentifier = IfmUtil.buildId(ifaceName);
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.put(CONFIGURATION, interfaceInstanceIdentifier, interfaceInfo, true);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class InterfaceMetaUtils method getBridgeReferenceForInterface.
public BridgeRefEntry getBridgeReferenceForInterface(Interface interfaceInfo) {
ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
BigInteger dpn = parentRefs.getDatapathNodeIdentifier();
return getBridgeRefEntryFromOperDS(dpn);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class InterfaceConfigListener method update.
@Override
protected void update(InstanceIdentifier<Interface> key, Interface interfaceOld, Interface interfaceNew) {
interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.debug("Received Interface Update Event: {}, {}, {}", key, interfaceOld, interfaceNew);
ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
if (parentRefs == null || parentRefs.getParentInterface() == null && !InterfaceManagerCommonUtils.isTunnelInterface(interfaceNew)) {
// If parentRefs are missing, try to find a matching parent and
// update - this will trigger another DCN
updateInterfaceParentRefs(interfaceNew);
}
if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
LOG.debug("parent refs not specified for {}, or parentRefs {} missing DPN/parentInterface", interfaceNew.getName(), parentRefs);
return;
}
RendererConfigUpdateWorker configWorker = new RendererConfigUpdateWorker(key, interfaceOld, interfaceNew, interfaceNew.getName());
String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs in project genius by opendaylight.
the class InterfaceConfigListener method add.
@Override
protected void add(InstanceIdentifier<Interface> key, Interface interfaceNew) {
interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.debug("Received Interface Add Event: {}, {}", key, interfaceNew);
ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
if (parentRefs == null || parentRefs.getParentInterface() == null) {
// If parentRefs are missing, try to find a matching parent and
// update - this will trigger another DCN
updateInterfaceParentRefs(interfaceNew);
}
if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
LOG.debug("parent refs not specified for {}", interfaceNew.getName());
return;
}
RendererConfigAddWorker configWorker = new RendererConfigAddWorker(key, interfaceNew, parentRefs, interfaceNew.getName());
String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
Aggregations