use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops in project netvirt by opendaylight.
the class NexthopManager method getVpnNexthop.
protected VpnNexthop getVpnNexthop(long vpnId, String ipAddress) {
// check if vpn node is there
InstanceIdentifierBuilder<VpnNexthops> idBuilder = InstanceIdentifier.builder(L3nexthop.class).child(VpnNexthops.class, new VpnNexthopsKey(vpnId));
InstanceIdentifier<VpnNexthops> id = idBuilder.build();
Optional<VpnNexthops> vpnNexthops = MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, id);
if (vpnNexthops.isPresent()) {
// get nexthops list for vpn
List<VpnNexthop> nexthops = vpnNexthops.get().getVpnNexthop();
for (VpnNexthop nexthop : nexthops) {
if (nexthop.getIpAddress().equals(ipAddress)) {
// return nexthop
LOG.trace("VpnNextHop : {}", nexthop);
return nexthop;
}
}
// return null if not found
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.VpnNexthops in project netvirt by opendaylight.
the class NexthopManager method addVpnNexthopToDS.
protected void addVpnNexthopToDS(BigInteger dpnId, long vpnId, String ipPrefix, long egressPointer) {
InstanceIdentifierBuilder<VpnNexthops> idBuilder = InstanceIdentifier.builder(L3nexthop.class).child(VpnNexthops.class, new VpnNexthopsKey(vpnId));
// Add nexthop to vpn node
VpnNexthop nh = new VpnNexthopBuilder().setKey(new VpnNexthopKey(ipPrefix)).setDpnId(dpnId).setIpAddress(ipPrefix).setFlowrefCount(1).setEgressPointer(egressPointer).build();
InstanceIdentifier<VpnNexthop> id1 = idBuilder.child(VpnNexthop.class, new VpnNexthopKey(ipPrefix)).build();
LOG.trace("Adding vpnnextHop {} to Operational DS", nh);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, id1, nh);
}
Aggregations