public VpnInstanceBuilder setDescription(final java.lang.String value) { if (value != null) { check_descriptionLength(value); } this._description = value; return this; }
@Override public String apply(VpnInstance vpnInstance) { return vpnInstance.getVpnInstanceName(); } };
public VpnInstance build() { return new VpnInstanceImpl(this); }
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; }
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()); } } }
public synchronized void deleteSubnetRouteFibEntryFromDS(String rd, String prefix, String vpnName){ fibManager.removeFibEntry(dataBroker, rd, prefix, null); List<VpnInstance> vpnsToImportRoute = getVpnsImportingMyRoute(vpnName); for (VpnInstance vpnInstance : vpnsToImportRoute) { String importingRd = vpnInstance.getIpv4Family().getRouteDistinguisher(); LOG.info("Deleting imported subnet route rd {} prefix {} from vpn {}", rd, prefix, vpnInstance.getVpnInstanceName()); fibManager.removeFibEntry(dataBroker, importingRd, prefix, 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); } }
@Override public String apply(VpnInstance vpnInstance) { //return vpnInstance.getVpnInstanceName(); return vpnInstance.getIpv4Family().getRouteDistinguisher(); } };
static InstanceIdentifier<VpnInstance> getVpnInstanceIdentifier(String vpnName) { return InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); }
@Override protected void add(final InstanceIdentifier<VpnInstance> identifier, final VpnInstance value) { LOG.trace("Add VPN event key: {}, value: {}", identifier, value); final VpnAfConfig config = value.getIpv4Family(); final String rd = config.getRouteDistinguisher(); final String vpnName = value.getVpnInstanceName(); DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance(); dataStoreCoordinator.enqueueJob("VPN-" + vpnName, new AddVpnInstanceWorker(idManager, vpnInterfaceManager, dataBroker, value)); }
public VpnInstanceBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
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; }
static InstanceIdentifier<VpnInstance> getVpnInstanceIdentifier(String vpnName) { return InstanceIdentifier.builder(VpnInstances.class) .child(VpnInstance.class, new VpnInstanceKey(vpnName)).build(); }
@Override public boolean apply(VpnInstance input) { return !input.getVpnInstanceName().equals(vpnName); } };
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; }
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; }
@Override public boolean apply(VpnInstance input) { return !input.getVpnInstanceName().equals(vpnName); } };
/** * 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; }
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; } }
/** * 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; }