public RouterDpnList build() { return new RouterDpnListImpl(this); }
public RouterDpnListBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public RouterDpnListBuilder(RouterDpnList base) { if (base.getKey() == null) { this._key = new RouterDpnListKey( base.getRouterId() ); this._routerId = base.getRouterId(); } else { this._key = base.getKey(); this._routerId = _key.getRouterId(); } this._dpnVpninterfacesList = base.getDpnVpninterfacesList(); if (base instanceof RouterDpnListImpl) { RouterDpnListImpl impl = (RouterDpnListImpl) 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.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
protected void addToNeutronRouterDpnsMap(String routerName, String vpnInterfaceName, WriteTransaction writeOperTxn) { BigInteger dpId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName); if(dpId.equals(BigInteger.ZERO)) { LOG.warn("Could not retrieve dp id for interface {} to handle router {} association model", vpnInterfaceName, routerName); return; } InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId); Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType .OPERATIONAL, routerDpnListIdentifier); RouterInterfaces routerInterface = new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(vpnInterfaceName).build(); if (optionalRouterDpnList.isPresent()) { writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child( RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)), routerInterface, true); } else { RouterDpnListBuilder builder = new RouterDpnListBuilder(); builder.setRouterId(routerName); DpnVpninterfacesListBuilder dpnVpnList = new DpnVpninterfacesListBuilder().setDpnId(dpId); List<RouterInterfaces> routerInterfaces = new ArrayList<>(); routerInterfaces.add(routerInterface); builder.setDpnVpninterfacesList(Arrays.asList(dpnVpnList.build())); writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, getRouterId(routerName), builder.build(), true); } }
public static List<BigInteger> getDpnsForRouter(DataBroker dataBroker, String routerUuid){ InstanceIdentifier id = InstanceIdentifier.builder(NeutronRouterDpns.class).child(RouterDpnList.class, new RouterDpnListKey(routerUuid)).build(); Optional<RouterDpnList> routerDpnListData = read(dataBroker, LogicalDatastoreType.OPERATIONAL, id); List<BigInteger> dpns = new ArrayList<>(); if (routerDpnListData.isPresent()) { List<DpnVpninterfacesList> dpnVpninterfacesList = routerDpnListData.get().getDpnVpninterfacesList(); for (DpnVpninterfacesList dpnVpnInterface : dpnVpninterfacesList) { dpns.add(dpnVpnInterface.getDpnId()); } return dpns; } return null; }
private RouterDpnListImpl(RouterDpnListBuilder base) { if (base.getKey() == null) { this._key = new RouterDpnListKey( base.getRouterId() ); this._routerId = base.getRouterId(); } else { this._key = base.getKey(); this._routerId = _key.getRouterId(); } this._dpnVpninterfacesList = base.getDpnVpninterfacesList(); 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.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public void updateTrasportZone(RouterDpnList routerDpnList) { try{ InstanceIdentifier<TransportZone> inst = InstanceIdentifier.create(TransportZones.class). child(TransportZone.class, new TransportZoneKey(routerDpnList.getRouterId())); TransportZone zone = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, inst); String subnetIp = ALL_SUBNETS; if (zone == null) { zone = createZone(subnetIp, routerDpnList.getRouterId()); } int addedTeps = 0; for (DpnVpninterfacesList dpnVpninterfacesList : routerDpnList.getDpnVpninterfacesList()) { BigInteger dpnId = dpnVpninterfacesList.getDpnId(); addedTeps += addVtep(zone, subnetIp, dpnId); } if (addedTeps > 0) { addTransportZone(zone, "router " + routerDpnList.getRouterId()); } } catch (Exception e) { LOG.warn("failed to add tunnels on router added of routerDpnList {} due to {}", routerDpnList, e.getMessage()); } }
if (!Objects.equals(_dpnVpninterfacesList, other.getDpnVpninterfacesList())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_routerId, other.getRouterId())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
@Override protected void add(final InstanceIdentifier<DpnVpninterfacesList> identifier, final DpnVpninterfacesList dpnInfo) { LOG.trace("Add event - key: {}, value: {}", identifier, dpnInfo); final String routerId = identifier.firstKeyOf(RouterDpnList.class).getRouterId(); BigInteger dpnId = dpnInfo.getDpnId();
public static Set<RouterDpnList> getAllRouterDpnList(DataBroker broker, BigInteger dpid) { Set<RouterDpnList> ret = new HashSet<>(); InstanceIdentifier<NeutronRouterDpns> routerDpnId = InstanceIdentifier.create(NeutronRouterDpns.class); Optional<NeutronRouterDpns> neutronRouterDpnsOpt = MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, routerDpnId); if (neutronRouterDpnsOpt.isPresent()) { NeutronRouterDpns neutronRouterDpns = neutronRouterDpnsOpt.get(); List<RouterDpnList> routerDpnLists = neutronRouterDpns.getRouterDpnList(); for (RouterDpnList routerDpnList : routerDpnLists) { if (routerDpnList.getDpnVpninterfacesList() != null) { for (DpnVpninterfacesList dpnInterfaceList : routerDpnList.getDpnVpninterfacesList()) { if (dpnInterfaceList.getDpnId().equals(dpid)) { ret.add(routerDpnList); } } } } } return ret; }
InstanceIdentifier<DpnVpninterfacesList> getRouterDpnId(String routerName, BigInteger dpnId) { return InstanceIdentifier.builder(NeutronRouterDpns.class) .child(RouterDpnList.class, new RouterDpnListKey(routerName)) .child(DpnVpninterfacesList.class, new DpnVpninterfacesListKey(dpnId)).build(); }
InstanceIdentifier<RouterDpnList> getRouterId(String routerName) { return InstanceIdentifier.builder(NeutronRouterDpns.class) .child(RouterDpnList.class, new RouterDpnListKey(routerName)).build(); }
@Override protected void remove(InstanceIdentifier<DpnVpninterfacesList> identifier, DpnVpninterfacesList dpnInfo) { LOG.trace("Remove event - key: {}, value: {}", identifier, dpnInfo); final String routerId = identifier.firstKeyOf(RouterDpnList.class).getRouterId(); BigInteger dpnId = dpnInfo.getDpnId();