@@ -177,7 +177,7 @@ private Answer execute(VpnUsersCfgCommand cmd) {
177177 args += "-u " ;
178178 args += userpwd .getUsernamePassword ();
179179 }
180- String result = routerProxy ( "vpn_l2tp.sh" , cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), args );
180+ String result = executeInVR ( cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), "vpn_l2tp.sh" , args );
181181 if (result != null ) {
182182 return new Answer (cmd , false , "Configure VPN user failed for user " + userpwd .getUsername ());
183183 }
@@ -204,7 +204,7 @@ private Answer execute(RemoteAccessVpnCfgCommand cmd) {
204204 }
205205 args += " -C " + cmd .getLocalCidr ();
206206 args += " -i " + cmd .getPublicInterface ();
207- String result = routerProxy ( "vpn_l2tp.sh" , cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), args );
207+ String result = executeInVR ( cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), "vpn_l2tp.sh" , args );
208208 if (result != null ) {
209209 return new Answer (cmd , false , "Configure VPN failed" );
210210 }
@@ -252,9 +252,9 @@ private Answer execute(SetFirewallRulesCommand cmd) {
252252 String result = null ;
253253
254254 if (trafficType == FirewallRule .TrafficType .Egress ) {
255- result = routerProxy ( "firewall_egress.sh" , routerIp , args );
255+ result = executeInVR ( routerIp , "firewall_egress.sh" , args );
256256 } else {
257- result = routerProxy ( "firewall_ingress.sh" , routerIp , args );
257+ result = executeInVR ( routerIp , "firewall_ingress.sh" , args );
258258 }
259259
260260 if (result != null ) {
@@ -278,7 +278,7 @@ private Answer execute(SetPortForwardingRulesCommand cmd) {
278278 args .append (" -r " ).append (rule .getDstIp ());
279279 args .append (" -d " ).append (rule .getStringDstPortRange ());
280280
281- String result = routerProxy ( "firewall_nat.sh" , routerIp , args .toString ());
281+ String result = executeInVR ( routerIp , "firewall_nat.sh" , args .toString ());
282282
283283 if (result == null || result .isEmpty ()) {
284284 results [i ++] = "Failed" ;
@@ -302,7 +302,7 @@ protected Answer SetVPCStaticNatRules(SetStaticNatRulesCommand cmd) {
302302 args += " -l " + rule .getSrcIp ();
303303 args += " -r " + rule .getDstIp ();
304304
305- String result = routerProxy ( "vpc_staticnat.sh" , routerIp , args );
305+ String result = executeInVR ( routerIp , "vpc_staticnat.sh" , args );
306306
307307 if (result == null ) {
308308 results [i ++] = null ;
@@ -337,7 +337,7 @@ private Answer execute(SetStaticNatRulesCommand cmd) {
337337 args .append (" -d " ).append (rule .getStringSrcPortRange ());
338338 args .append (" -G " );
339339
340- String result = routerProxy ( "firewall_nat.sh" , routerIp , args .toString ());
340+ String result = executeInVR ( routerIp , "firewall_nat.sh" , args .toString ());
341341
342342 if (result == null || result .isEmpty ()) {
343343 results [i ++] = "Failed" ;
@@ -420,10 +420,10 @@ private Answer execute(LoadBalancerConfigCommand cmd) {
420420
421421 if (cmd .getVpcId () == null ) {
422422 args = " -i " + routerIp + args ;
423- result = routerProxy ( "loadbalancer.sh" , routerIp , args );
423+ result = executeInVR ( routerIp , "loadbalancer.sh" , args );
424424 } else {
425425 args = " -i " + cmd .getNic ().getIp () + args ;
426- result = routerProxy ( "vpc_loadbalancer.sh" , routerIp , args );
426+ result = executeInVR ( routerIp , "vpc_loadbalancer.sh" , args );
427427 }
428428
429429 if (result != null ) {
@@ -449,7 +449,7 @@ protected Answer execute(VmDataCommand cmd) {
449449
450450 String args = "-d " + json ;
451451
452- final String result = routerProxy ( "vmdata.py" , routerIp , args );
452+ final String result = executeInVR ( routerIp , "vmdata.py" , args );
453453 if (result != null ) {
454454 return new Answer (cmd , false , "VmDataCommand failed, check agent logs" );
455455 }
@@ -485,7 +485,7 @@ protected Answer execute(final SavePasswordCommand cmd) {
485485 String args = "-v " + vmIpAddress ;
486486 args += " -p " + password ;
487487
488- String result = routerProxy ( "savepassword.sh" , routerPrivateIPAddress , args );
488+ String result = executeInVR ( routerPrivateIPAddress , "savepassword.sh" , args );
489489 if (result != null ) {
490490 return new Answer (cmd , false , "Unable to save password to DomR." );
491491 }
@@ -520,7 +520,7 @@ protected Answer execute(final DhcpEntryCommand cmd) {
520520 args += " -N" ;
521521 }
522522
523- final String result = routerProxy ( "edithosts.sh" , cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), args );
523+ final String result = executeInVR ( cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), "edithosts.sh" , args );
524524 return new Answer (cmd , result == null , result );
525525 }
526526
@@ -531,7 +531,7 @@ protected Answer execute(final CreateIpAliasCommand cmd) {
531531 for (IpAliasTO ipaliasto : ipAliasTOs ) {
532532 args = args + ipaliasto .getAlias_count () + ":" + ipaliasto .getRouterip () + ":" + ipaliasto .getNetmask () + "-" ;
533533 }
534- final String result = routerProxy ( "createipAlias.sh" , routerIp , args );
534+ final String result = executeInVR ( routerIp , "createipAlias.sh" , args );
535535 return new Answer (cmd , result == null , result );
536536 }
537537
@@ -547,7 +547,7 @@ protected Answer execute(final DeleteIpAliasCommand cmd) {
547547 for (IpAliasTO ipAliasTO : activeIpAliasTOs ) {
548548 args = args + ipAliasTO .getAlias_count () + ":" + ipAliasTO .getRouterip () + ":" + ipAliasTO .getNetmask () + "-" ;
549549 }
550- final String result = routerProxy ( "deleteipAlias.sh" , routerIp , args );
550+ final String result = executeInVR ( routerIp , "deleteipAlias.sh" , args );
551551 return new Answer (cmd , result == null , result );
552552 }
553553
@@ -558,7 +558,7 @@ protected Answer execute(final DnsMasqConfigCommand cmd) {
558558 for (DhcpTO dhcpTo : dhcpTos ) {
559559 args = args + dhcpTo .getRouterIp () + ":" + dhcpTo .getGateway () + ":" + dhcpTo .getNetmask () + ":" + dhcpTo .getStartIpOfSubnet () + "-" ;
560560 }
561- final String result = routerProxy ( "dnsmasq.sh" , routerIp , args );
561+ final String result = executeInVR ( routerIp , "dnsmasq.sh" , args );
562562 return new Answer (cmd , result == null , result );
563563 }
564564
@@ -589,14 +589,14 @@ private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd)
589589 args += " " + ip ;
590590 }
591591
592- final String result = routerProxy ( "checkbatchs2svpn.sh" , routerIP , args );
592+ final String result = executeInVR ( routerIP , "checkbatchs2svpn.sh" , args );
593593 if (result == null || result .isEmpty ()) {
594594 return new CheckS2SVpnConnectionsAnswer (cmd , false , "CheckS2SVpnConneciontsCommand failed" );
595595 }
596596 return new CheckS2SVpnConnectionsAnswer (cmd , true , result );
597597 }
598598
599- public String routerProxy (String script , String routerIP , String args ) {
599+ public String executeInVR (String routerIP , String script , String args ) {
600600 final Script command = new Script (_routerProxyPath , _timeout , s_logger );
601601 command .add (script );
602602 command .add (routerIP );
@@ -617,7 +617,7 @@ protected Answer execute(CheckRouterCommand cmd) {
617617 }
618618
619619 protected Answer execute (BumpUpPriorityCommand cmd ) {
620- String result = routerProxy ( "bumpup_priority.sh" , cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), null );
620+ String result = executeInVR ( cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), "bumpup_priority.sh" , null );
621621 if (result != null ) {
622622 return new Answer (cmd , false , "BumpUpPriorityCommand failed due to " + result );
623623 }
@@ -692,7 +692,7 @@ protected Answer execute(Site2SiteVpnCfgCommand cmd) {
692692 args += " -N " ;
693693 args += cmd .getPeerGuestCidrList ();
694694 }
695- String result = routerProxy ( "ipsectunnel.sh" , cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), args );
695+ String result = executeInVR ( cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP ), "ipsectunnel.sh" , args );
696696 if (result != null ) {
697697 return new Answer (cmd , false , "Configure site to site VPN failed due to " + result );
698698 }
@@ -740,7 +740,7 @@ private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fin
740740 public String configureMonitor (final String routerIP , final String config ) {
741741
742742 String args = " -c " + config ;
743- return routerProxy ( "monitor_service.sh" , routerIP , args );
743+ return executeInVR ( routerIP , "monitor_service.sh" , args );
744744 }
745745
746746 public String assignGuestNetwork (final String dev , final String routerIP , final String routerGIP , final String gateway , final String cidr , final String netmask ,
@@ -758,19 +758,19 @@ public String assignGuestNetwork(final String dev, final String routerIP, final
758758 if (domainName != null && !domainName .isEmpty ()) {
759759 args += " -e " + domainName ;
760760 }
761- return routerProxy ( "vpc_guestnw.sh" , routerIP , args );
761+ return executeInVR ( routerIP , "vpc_guestnw.sh" , args );
762762 }
763763
764764 public String assignNetworkACL (final String routerIP , final String dev , final String routerGIP , final String netmask , final String rule , String privateGw ) {
765765 String args = " -d " + dev ;
766766 if (privateGw != null ) {
767767 args += " -a " + rule ;
768- return routerProxy ( "vpc_privategw_acl.sh" , routerIP , args );
768+ return executeInVR ( routerIP , "vpc_privategw_acl.sh" , args );
769769 } else {
770770 args += " -i " + routerGIP ;
771771 args += " -m " + netmask ;
772772 args += " -a " + rule ;
773- return routerProxy ( "vpc_acl.sh" , routerIP , args );
773+ return executeInVR ( routerIP , "vpc_acl.sh" , args );
774774 }
775775 }
776776
@@ -780,7 +780,7 @@ public String assignSourceNat(final String routerIP, final String pubIP, final S
780780 args += pubIP ;
781781 args += " -c " ;
782782 args += dev ;
783- return routerProxy ( "vpc_snat.sh" , routerIP , args );
783+ return executeInVR ( routerIP , "vpc_snat.sh" , args );
784784 }
785785
786786 private SetPortForwardingRulesAnswer execute (SetPortForwardingRulesVpcCommand cmd ) {
@@ -797,7 +797,7 @@ private SetPortForwardingRulesAnswer execute(SetPortForwardingRulesVpcCommand cm
797797 args += " -r " + rule .getDstIp ();
798798 args += " -d " + rule .getStringDstPortRange ().replace (":" , "-" );
799799
800- String result = routerProxy ( "vpc_portforwarding.sh" , routerIp , args );
800+ String result = executeInVR ( routerIp , "vpc_portforwarding.sh" , args );
801801
802802 if (result != null ) {
803803 results [i ++] = "Failed" ;
@@ -833,15 +833,15 @@ public void assignVpcIpToRouter(final String routerIP, final boolean add, final
833833 args += " -n " ;
834834 args += subnet ;
835835
836- String result = routerProxy ( "vpc_ipassoc.sh" , routerIP , args );
836+ String result = executeInVR ( routerIP , "vpc_ipassoc.sh" , args );
837837 if (result != null ) {
838838 throw new InternalErrorException ("KVM plugin \" vpc_ipassoc\" failed:" + result );
839839 }
840840 if (sourceNat ) {
841841 snatArgs += " -l " + pubIP ;
842842 snatArgs += " -c " + nicname ;
843843
844- result = routerProxy ( "vpc_privateGateway.sh" , routerIP , snatArgs );
844+ result = executeInVR ( routerIP , "vpc_privateGateway.sh" , snatArgs );
845845 if (result != null ) {
846846 throw new InternalErrorException ("KVM plugin \" vpc_privateGateway\" failed:" + result );
847847 }
@@ -862,7 +862,7 @@ private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) {
862862 }
863863
864864 String args = " -a " + sb .toString ();
865- String result = routerProxy ( "vpc_staticroute.sh" , routerIP , args );
865+ String result = executeInVR ( routerIP , "vpc_staticroute.sh" , args );
866866
867867 if (result != null ) {
868868 for (int i = 0 ; i < results .length ; i ++) {
@@ -923,7 +923,7 @@ public String assignPublicIpAddress(final String vmName, final String privateIpA
923923 args += " -n" ;
924924 }
925925
926- return routerProxy ( "ipassoc.sh" , privateIpAddress , args );
926+ return executeInVR ( privateIpAddress , "ipassoc.sh" , args );
927927 }
928928
929929 private void deleteBridge (String brName ) {
0 commit comments