public static VpnInstance getVpnInstance(DataBroker broker, String vpnInstanceName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class, new VpnInstanceKey(vpnInstanceName)).build(); Optional<VpnInstance> vpnInstance = read(broker, LogicalDatastoreType.CONFIGURATION, id); return (vpnInstance.isPresent()) ? vpnInstance.get() : null; }
private VpnInstanceImpl(VpnInstanceBuilder base) { if (base.getKey() == null) { this._key = new VpnInstanceKey( base.getVpnInstanceName() ); this._vpnInstanceName = base.getVpnInstanceName(); } else { this._key = base.getKey(); this._vpnInstanceName = _key.getVpnInstanceName(); } this._description = base.getDescription(); this._ipv4Family = base.getIpv4Family(); this._ipv6Family = base.getIpv6Family(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>>, Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>>, Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
protected long getVpnId(String vpnName) { InstanceIdentifierBuilder<VpnInstance> idBuilder = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)); InstanceIdentifier<VpnInstance> id = idBuilder.build(); InstanceIdentifier<VpnInstance1> idx = id.augmentation(VpnInstance1.class); Optional<VpnInstance1> vpn = read(LogicalDatastoreType.OPERATIONAL, idx); if (vpn.isPresent()) { LOG.debug("VPN id returned: {}", vpn.get().getVpnId()); return vpn.get().getVpnId(); } else { return -1; } }
public VpnInstanceBuilder(VpnInstance base) { if (base.getKey() == null) { this._key = new VpnInstanceKey( base.getVpnInstanceName() ); this._vpnInstanceName = base.getVpnInstanceName(); } else { this._key = base.getKey(); this._vpnInstanceName = _key.getVpnInstanceName(); } this._description = base.getDescription(); this._ipv4Family = base.getIpv4Family(); this._ipv6Family = base.getIpv6Family(); if (base instanceof VpnInstanceImpl) { VpnInstanceImpl impl = (VpnInstanceImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
static InstanceIdentifier<VpnInstance> getVpnInstanceIdentifier(String vpnName) { return InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); }
static InstanceIdentifier<VpnInstance> getVpnInstanceIdentifier(String vpnName) { return InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); }
.child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> optVpnInstance = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, id); final VpnInstance vpnInstance;
.child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> optVpnInstance = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, id); final VpnInstance vpnInstance;
private String getRouteDistinguisher(String vpnName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> vpnInstance = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, id); String rd = ""; if(vpnInstance.isPresent()) { VpnInstance instance = vpnInstance.get(); VpnAfConfig config = instance.getIpv4Family(); rd = config.getRouteDistinguisher(); } return rd; }
private String getRouteDistinguisher(String vpnName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> vpnInstance = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, id); String rd = null; if(vpnInstance.isPresent()) { VpnInstance instance = vpnInstance.get(); VpnAfConfig config = instance.getIpv4Family(); rd = config.getRouteDistinguisher(); } return rd; }
private String getRouteDistinguisher(String vpnName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> vpnInstance = VpnUtil.read(broker, LogicalDatastoreType.CONFIGURATION, id); String rd = ""; if(vpnInstance.isPresent()) { VpnInstance instance = vpnInstance.get(); VpnAfConfig config = instance.getIpv4Family(); rd = config.getRouteDistinguisher(); } return rd; }
/** * Get RouterDistinguisher by VpnName * * @param vpnName Name of the VPN Instance * @return the Route-Distinguisher */ private String getRouteDistinguisher(String vpnName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> vpnInstance = MDSALDataStoreUtils.read(broker, LogicalDatastoreType.CONFIGURATION, id); String rd = ""; if (vpnInstance.isPresent()) { VpnInstance instance = vpnInstance.get(); VpnAfConfig config = instance.getIpv4Family(); rd = config.getRouteDistinguisher(); } return rd; }
/** * Get VPN Route Distinguisher from VPN Instance Configuration * * @param broker dataBroker service reference * @param vpnName Name of the VPN * @return the route-distinguisher of the VPN */ public static String getVpnRdFromVpnInstanceConfig(DataBroker broker, String vpnName) { InstanceIdentifier<VpnInstance> id = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); Optional<VpnInstance> vpnInstance = VpnUtil.read(broker, LogicalDatastoreType.CONFIGURATION, id); String rd = null; if (vpnInstance.isPresent()) { VpnInstance instance = vpnInstance.get(); VpnAfConfig config = instance.getIpv4Family(); rd = config.getRouteDistinguisher(); } return rd; }
try { InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class, new VpnInstanceKey (vpn.getValue())).build(); Optional<VpnInstance> optionalVpn = NeutronvpnUtils.read(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdentifier);
private void deleteVpnInstance(Uuid vpnId) { boolean isLockAcquired = false; InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnId.getValue())) .build(); try { isLockAcquired = NeutronvpnUtils.lock(lockManager, vpnId.getValue()); LOG.debug("Deleting vpnInstance {}", vpnId.getValue()); MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdentifier); } catch (Exception e) { LOG.error("Deletion of VPNInstance node failed for VPN {}", vpnId.getValue()); } finally { if (isLockAcquired) { NeutronvpnUtils.unlock(lockManager, vpnId.getValue()); } } }
boolean isLockAcquired = false; InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class,new VpnInstanceKey(vpnName)).build(); try { Optional<VpnInstance> optionalVpn = NeutronvpnUtils.read(dataBroker, LogicalDatastoreType.CONFIGURATION, LOG.debug("updating existing vpninstance node"); } else { builder = new VpnInstanceBuilder().setKey(new VpnInstanceKey(vpnName)).setVpnInstanceName(vpnName);
InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(name)) .build();