@@ -474,13 +474,12 @@ protected Answer execute(VmDataCommand cmd) {
474474
475475 protected Answer execute (final SavePasswordCommand cmd ) {
476476 final String password = cmd .getPassword ();
477- final String routerPrivateIPAddress = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
478477 final String vmIpAddress = cmd .getVmIpAddress ();
479478
480479 String args = "-v " + vmIpAddress ;
481480 args += " -p " + password ;
482481
483- ExecutionResult result = _vrDeployer .executeInVR (routerPrivateIPAddress , VRScripts .PASSWORD , args );
482+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .PASSWORD , args );
484483 return new Answer (cmd , result .isSuccess (), result .getDetails ());
485484 }
486485
@@ -512,7 +511,7 @@ protected Answer execute(final DhcpEntryCommand cmd) {
512511 args += " -N" ;
513512 }
514513
515- final ExecutionResult result = _vrDeployer .executeInVR (cmd .getAccessDetail ( NetworkElementCommand . ROUTER_IP ), VRScripts .DHCP , args );
514+ final ExecutionResult result = _vrDeployer .executeInVR (cmd .getRouterAccessIp ( ), VRScripts .DHCP , args );
516515 return new Answer (cmd , result .isSuccess (), result .getDetails ());
517516 }
518517
@@ -553,36 +552,30 @@ protected Answer execute(final DnsMasqConfigCommand cmd) {
553552 }
554553
555554 private CheckS2SVpnConnectionsAnswer execute (CheckS2SVpnConnectionsCommand cmd ) {
556- final String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
557-
558555 String args = "" ;
559556 for (String ip : cmd .getVpnIps ()) {
560557 args += ip + " " ;
561558 }
562559
563- ExecutionResult result = _vrDeployer .executeInVR (routerIP , VRScripts .S2SVPN_CHECK , args );
560+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .S2SVPN_CHECK , args );
564561 return new CheckS2SVpnConnectionsAnswer (cmd , result .isSuccess (), result .getDetails ());
565562 }
566563
567564 protected Answer execute (CheckRouterCommand cmd ) {
568- final String routerPrivateIPAddress = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
569-
570- final ExecutionResult result = _vrDeployer .executeInVR (routerPrivateIPAddress , VRScripts .RVR_CHECK , null );
565+ final ExecutionResult result = _vrDeployer .executeInVR (cmd .getRouterAccessIp (), VRScripts .RVR_CHECK , null );
571566 if (!result .isSuccess ()) {
572567 return new CheckRouterAnswer (cmd , result .getDetails ());
573568 }
574569 return new CheckRouterAnswer (cmd , result .getDetails (), true );
575570 }
576571
577572 protected Answer execute (BumpUpPriorityCommand cmd ) {
578- ExecutionResult result = _vrDeployer .executeInVR (cmd .getAccessDetail ( NetworkElementCommand . ROUTER_IP ), VRScripts .RVR_BUMPUP_PRI , null );
573+ ExecutionResult result = _vrDeployer .executeInVR (cmd .getRouterAccessIp ( ), VRScripts .RVR_BUMPUP_PRI , null );
579574 return new Answer (cmd , result .isSuccess (), result .getDetails ());
580575 }
581576
582577 protected Answer execute (GetDomRVersionCmd cmd ) {
583- final String routerPrivateIPAddress = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
584-
585- final ExecutionResult result = _vrDeployer .executeInVR (routerPrivateIPAddress , VRScripts .VERSION , null );
578+ final ExecutionResult result = _vrDeployer .executeInVR (cmd .getRouterAccessIp (), VRScripts .VERSION , null );
586579 if (!result .isSuccess ()) {
587580 return new GetDomRVersionAnswer (cmd , "GetDomRVersionCmd failed" );
588581 }
@@ -635,7 +628,7 @@ protected Answer execute(Site2SiteVpnCfgCommand cmd) {
635628 args += " -N " ;
636629 args += cmd .getPeerGuestCidrList ();
637630 }
638- ExecutionResult result = _vrDeployer .executeInVR (cmd .getAccessDetail ( NetworkElementCommand . ROUTER_IP ), VRScripts .S2SVPN_IPSEC , args );
631+ ExecutionResult result = _vrDeployer .executeInVR (cmd .getRouterAccessIp ( ), VRScripts .S2SVPN_IPSEC , args );
639632 if (!result .isSuccess ()) {
640633 return new Answer (cmd , false , "Configure site to site VPN failed due to " + result .getDetails ());
641634 }
@@ -662,7 +655,6 @@ protected Answer execute(SetMonitorServiceCommand cmd) {
662655
663656 protected Answer execute (SetupGuestNetworkCommand cmd ) {
664657 NicTO nic = cmd .getNic ();
665- String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
666658 String routerGIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_GUEST_IP );
667659 String gateway = cmd .getAccessDetail (NetworkElementCommand .GUEST_NETWORK_GATEWAY );
668660 String cidr = Long .toString (NetUtils .getCidrSize (nic .getNetmask ()));
@@ -694,7 +686,7 @@ protected Answer execute(SetupGuestNetworkCommand cmd) {
694686 if (domainName != null && !domainName .isEmpty ()) {
695687 args += " -e " + domainName ;
696688 }
697- ExecutionResult result = _vrDeployer .executeInVR (routerIP , VRScripts .VPC_GUEST_NETWORK , args );
689+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .VPC_GUEST_NETWORK , args );
698690
699691 if (!result .isSuccess ()) {
700692 return new Answer (cmd , false , "Creating guest network failed due to " + result .getDetails ());
@@ -750,15 +742,14 @@ private SetNetworkACLAnswer execute(SetNetworkACLCommand cmd) {
750742 }
751743
752744 protected Answer execute (SetSourceNatCommand cmd ) {
753- String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
754745 IpAddressTO pubIP = cmd .getIpAddress ();
755746 String dev = "eth" + pubIP .getNicDevId ();
756747 String args = " -A " ;
757748 args += " -l " ;
758749 args += pubIP .getPublicIp ();
759750 args += " -c " ;
760751 args += dev ;
761- ExecutionResult result = _vrDeployer .executeInVR (routerIP , VRScripts .VPC_SOURCE_NAT , args );
752+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .VPC_SOURCE_NAT , args );
762753 return new Answer (cmd , result .isSuccess (), result .getDetails ());
763754 }
764755
@@ -788,7 +779,6 @@ private SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cm
788779 }
789780
790781 public IpAssocAnswer execute (IpAssocVpcCommand cmd ) {
791- String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
792782 String [] results = new String [cmd .getIpAddresses ().length ];
793783 String args = "" ;
794784 String snatArgs = "" ;
@@ -818,7 +808,7 @@ public IpAssocAnswer execute(IpAssocVpcCommand cmd) {
818808 args += " -n " ;
819809 args += NetUtils .getSubNet (ip .getPublicIp (), ip .getVlanNetmask ());
820810
821- ExecutionResult result = _vrDeployer .executeInVR (routerIP , VRScripts .VPC_IPASSOC , args );
811+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .VPC_IPASSOC , args );
822812 if (!result .isSuccess ()) {
823813 results [i ++] = ip .getPublicIp () + " - vpc_ipassoc failed:" + result .getDetails ();
824814 break ;
@@ -828,7 +818,7 @@ public IpAssocAnswer execute(IpAssocVpcCommand cmd) {
828818 snatArgs += " -l " + ip .getPublicIp ();
829819 snatArgs += " -c " + nicName ;
830820
831- result = _vrDeployer .executeInVR (routerIP , VRScripts .VPC_PRIVATEGW , snatArgs );
821+ result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .VPC_PRIVATEGW , snatArgs );
832822 if (result != null ) {
833823 results [i ++] = ip .getPublicIp () + " - vpc_privateGateway failed:" + result .getDetails ();
834824 break ;
@@ -840,7 +830,6 @@ public IpAssocAnswer execute(IpAssocVpcCommand cmd) {
840830 }
841831
842832 private SetStaticRouteAnswer execute (SetStaticRouteCommand cmd ) {
843- String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
844833 try {
845834 String [] results = new String [cmd .getStaticRoutes ().length ];
846835 String [][] rules = cmd .generateSRouteRules ();
@@ -852,7 +841,7 @@ private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) {
852841 }
853842
854843 String args = " -a " + sb .toString ();
855- ExecutionResult result = _vrDeployer .executeInVR (routerIP , VRScripts .VPC_STATIC_ROUTE , args );
844+ ExecutionResult result = _vrDeployer .executeInVR (cmd . getRouterAccessIp () , VRScripts .VPC_STATIC_ROUTE , args );
856845
857846 if (!result .isSuccess ()) {
858847 for (int i = 0 ; i < results .length ; i ++) {
0 commit comments