+ private int createNextHopPointer(String nexthopKey) {
+ GetUniqueIdInput getIdInput = new GetUniqueIdInputBuilder()
+ .setPoolName("nextHopPointerPool").setIdKey(nexthopKey)
+ .build();
+ //TODO: Proper error handling once IdManager code is complete
+ try {
+ Future<RpcResult<GetUniqueIdOutput>> result = idManager.getUniqueId(getIdInput);
+ RpcResult<GetUniqueIdOutput> rpcResult = result.get();
+ return rpcResult.getResult().getIdValue().intValue();
+ } catch (NullPointerException | InterruptedException | ExecutionException e) {
+ LOG.trace("",e);
+ }
+ return 0;
+ }
+
+ public void createLocalNextHop(String ifName, String vpnName, String ipAddress, String macAddress) {
+ String nhKey = new String("nexthop." + vpnName + ipAddress);
+ int groupId = createNextHopPointer(nhKey);
+
+ long vpnId = getVpnId(vpnName);
+ long dpnId = interfaceManager.getDpnForInterface(ifName);
+ VpnNexthop nexthop = getVpnNexthop(vpnId, ipAddress);
+ if (nexthop == null) {
+ List<BucketInfo> listBucketInfo = new ArrayList<BucketInfo>();
+ List<ActionInfo> listActionInfo = interfaceManager.getInterfaceEgressActions(ifName);
+ BucketInfo bucket = new BucketInfo(listActionInfo);
+ // MAC re-write
+ if (macAddress != null) {
+ listActionInfo.add(new ActionInfo(ActionType.set_field_eth_dest, new String[]{macAddress}));
+ } else {
+ //FIXME: Log message here.
+ }
+ listBucketInfo.add(bucket);
+ GroupEntity groupEntity = MDSALUtil.buildGroupEntity(
+ dpnId, groupId, ipAddress, GroupTypes.GroupIndirect, listBucketInfo);
+
+ // install Group
+ mdsalManager.installGroup(groupEntity);
+
+ //update MD-SAL DS
+ addVpnNexthopToDS(vpnId, ipAddress, groupId);
+ } else {
+ //check update
+ }
+ }
+
+ public void createRemoteNextHop(String ifName, String ofPortId, String ipAddress) {