BucketInfo bucket = new BucketInfo(listActionInfo);
// MAC re-write
if (macAddress != null) {
- listActionInfo.add(new ActionInfo(ActionType.set_field_eth_dest, new String[]{macAddress}));
+ listActionInfo.add(0, new ActionInfo(ActionType.set_field_eth_dest, new String[]{macAddress}));
+ listActionInfo.add(new ActionInfo(ActionType.pop_mpls, new String[]{}));
} else {
//FIXME: Log message here.
}
// check if vpn node is there or to be created
InstanceIdentifier<VpnNexthops> id = idBuilder.build();
- Optional<VpnNexthops> nexthops = read(LogicalDatastoreType.CONFIGURATION, id);
+ Optional<VpnNexthops> nexthops = read(LogicalDatastoreType.OPERATIONAL, id);
if (!nexthops.isPresent()) {
// create a new node
VpnNexthops node = new VpnNexthopsBuilder().setKey(new VpnNexthopsKey(vpnId)).setVpnId(vpnId).build();
// check if dpn node is there or to be created
InstanceIdentifier<TunnelNexthops> id = idBuilder.build();
- Optional<TunnelNexthops> nexthops = read(LogicalDatastoreType.CONFIGURATION, id);
+ Optional<TunnelNexthops> nexthops = read(LogicalDatastoreType.OPERATIONAL, id);
if (!nexthops.isPresent()) {
// create a new node
TunnelNexthops node = new TunnelNexthopsBuilder()
InstanceIdentifierBuilder<VpnNexthops> idBuilder = InstanceIdentifier.builder(L3nexthop.class)
.child(VpnNexthops.class, new VpnNexthopsKey(vpnId));
InstanceIdentifier<VpnNexthops> id = idBuilder.build();
- Optional<VpnNexthops> vpnNexthops = read(LogicalDatastoreType.CONFIGURATION, id);
- if (!vpnNexthops.isPresent()) {
+ Optional<VpnNexthops> vpnNexthops = read(LogicalDatastoreType.OPERATIONAL, id);
+ if (vpnNexthops.isPresent()) {
// get nexthops list for vpn
List<VpnNexthop> nexthops = vpnNexthops.get().getVpnNexthop();
// check if vpn node is there
InstanceIdentifier<TunnelNexthops> id = idBuilder.build();
- Optional<TunnelNexthops> dpnNexthops = read(LogicalDatastoreType.CONFIGURATION, id);
- if (!dpnNexthops.isPresent()) {
+ Optional<TunnelNexthops> dpnNexthops = read(LogicalDatastoreType.OPERATIONAL, id);
+ if (dpnNexthops.isPresent()) {
List<TunnelNexthop> nexthops = dpnNexthops.get().getTunnelNexthop();
for (TunnelNexthop nexthop : nexthops) {
if (nexthop.getIpAddress().equals(ipAddress)) {
}
- public void removeLocalNextHop(String vpnName, String ipAddress) {
-
- long vpnId = getVpnId(vpnName);
+ public void removeLocalNextHop(Long dpId, Long vpnId, String ipAddress) {
VpnNexthop nh = getVpnNexthop(vpnId, ipAddress);
if (nh != null) {
// how to inform and remove dependent FIB entries??
// we need to do it before the group is removed
-
+ GroupEntity groupEntity = MDSALUtil.buildGroupEntity(
+ dpId, nh.getEgressPointer(), ipAddress, GroupTypes.GroupIndirect, null);
// remove Group ...
-
+ mdsalManager.removeGroup(groupEntity);
//update MD-SAL DS
removeVpnNexthopFromDS(vpnId, ipAddress);
} else {
// we need to do it before the group is removed
// remove Group ...
+ GroupEntity groupEntity = MDSALUtil.buildGroupEntity(
+ dpnId, nh.getEgressPointer(), ipAddress, GroupTypes.GroupIndirect, null);
+ // remove Group ...
+ mdsalManager.removeGroup(groupEntity);
//update MD-SAL DS
removeTunnelNexthopFromDS(dpnId, ipAddress);
} else {
Futures.addCallback(tx.submit(), DEFAULT_CALLBACK);
}
+ @Override
+ public Future<RpcResult<Void>> removeLocalNextHop(RemoveLocalNextHopInput input) {
+ VpnNexthop vpnNextHop = getVpnNexthop(input.getVpnId(), input.getIpPrefix());
+ RpcResultBuilder<Void> rpcResultBuilder;
+ LOG.debug("vpnnexthop is: {}", vpnNextHop);
+ try {
+ removeLocalNextHop(input.getDpnId(),input.getVpnId(), input.getIpPrefix());
+ rpcResultBuilder = RpcResultBuilder.success();
+ }
+ catch(Exception e){
+ LOG.error("Removal of local next hop for vpnNextHop {} failed {}" ,vpnNextHop, e);
+ rpcResultBuilder = RpcResultBuilder.failed();
+ }
+ return Futures.immediateFuture(rpcResultBuilder.build());
+ }
+
}