Fixed the path of the onos-netcfg

Change-Id: I60e5cdf6c8863c235395d341c4db21d4c5ba2ef3
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index aa3aff5..be8a9d4 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -25,7 +25,8 @@
 # Setup a path
 export PATH="$PATH:$ONOS_ROOT/tools/dev/bin"
 export PATH="$PATH:$ONOS_ROOT/tools/test/bin:$ONOS_ROOT/tools/test/scenarios/bin"
-export PATH="$ONOS_ROOT/tools/package/runtime/bin:$PATH"
+export RUN_PACK_PATH=${RUN_PACK_PATH:-$ONOS_ROOT/tools/package/runtime/bin}
+export PATH="$RUN_PACK_PATH:$PATH"
 export PATH="$PATH:$ONOS_ROOT/tools/build"
 export PATH="$PATH:$MAVEN/bin:$KARAF_ROOT/bin"
 
diff --git a/tools/test/topos/bmv2-demo.py b/tools/test/topos/bmv2-demo.py
index d1aa579..646c7353 100644
--- a/tools/test/topos/bmv2-demo.py
+++ b/tools/test/topos/bmv2-demo.py
@@ -10,6 +10,11 @@
 else:
     ONOS_ROOT = os.environ["ONOS_ROOT"]
     sys.path.append(ONOS_ROOT + "/tools/dev/mininet")
+if 'RUN_PACK_PATH' not in os.environ:
+    print "Environment var $RUN_PACK_PATH not set"
+    exit()
+else:
+    RUN_PACK_PATH = os.environ["RUN_PACK_PATH"]
 
 from onos import ONOSCluster, ONOSCLI
 from bmv2 import ONOSBmv2Switch
@@ -161,7 +166,7 @@
     # net.hosts[0].startIperfClient(net.hosts[-1], flowBw="200k", numFlows=100, duration=10)
 
     print "Setting netcfg..."
-    call(("%s/tools/test/bin/onos-netcfg" % ONOS_ROOT, onosIp,
+    call(("%s/onos-netcfg" % RUN_PACK_PATH, onosIp,
           "%s/tools/test/topos/bmv2-demo-cfg.json" % ONOS_ROOT))
 
     if not args.onos_ip:
diff --git a/tools/test/topos/ectest.py b/tools/test/topos/ectest.py
index 1b92415..37acfc5 100755
--- a/tools/test/topos/ectest.py
+++ b/tools/test/topos/ectest.py
@@ -209,8 +209,8 @@
         with open(filename, 'w') as outfile:
             json.dump(domainCfgs[i], outfile, indent=4, separators=(',', ': '))
 
-        output = quietRun('%s/tools/test/bin/onos-netcfg %s %s &'\
-                           % (LINCSwitch.onosDir,
+        output = quietRun('%s/onos-netcfg %s %s &'\
+                           % (LINCSwitch.runPackDir,
                               domains[i].getControllers()[0].ip,
                               filename), shell=True)
         # successful output contains the two characters '{}'
diff --git a/tools/test/topos/metro.py b/tools/test/topos/metro.py
index 10bba5f..76f4ed2 100755
--- a/tools/test/topos/metro.py
+++ b/tools/test/topos/metro.py
@@ -232,8 +232,8 @@
         with open(filename, 'w') as outfile:
             json.dump(domainCfgs[i], outfile, indent=4, separators=(',', ': '))
 
-        output = quietRun('%s/tools/test/bin/onos-netcfg %s %s &'\
-                           % (LINCSwitch.onosDir,
+        output = quietRun('%s/onos-netcfg %s %s &'\
+                           % (LINCSwitch.runPackDir,
                               domains[i].getControllers()[0].ip,
                               filename), shell=True)
         # successful output contains the two characters '{}'
diff --git a/tools/test/topos/opticalUtils.py b/tools/test/topos/opticalUtils.py
index 6730b80..e8db648 100644
--- a/tools/test/topos/opticalUtils.py
+++ b/tools/test/topos/opticalUtils.py
@@ -264,7 +264,7 @@
     sysConfig = "/home/{}/linc-oe/rel/linc/releases/1.0/sys.config".format(user)
     ### dict of containing dpids as key and corresponding LINC switchId as values ###
     dpidsToLINCSwitchId = dpids_to_ids(sysConfig)
-    
+
     ### ONOS Directory ###
     try:
         onosDir = os.environ[ 'ONOS_ROOT' ]
@@ -274,6 +274,12 @@
             error('Please set ONOS_ROOT environment variable!\n')
         else:
             os.environ[ 'ONOS_ROOT' ] = onosDir
+    ### ONOS-netcfg directory ###
+    try:
+        runPackDir = os.environ[ 'RUN_PACK_PATH' ]
+    except:
+        runPackDir = onosDir+"/tools/package/runtime/bin"
+        os.environ[ 'RUN_PACK_PATH' ] = runPackDir
     ### REST USER/PASS ###
     try:
         restUser = os.environ[ 'ONOS_WEB_USER' ]
@@ -412,8 +418,8 @@
         with open("crossConnect.json", 'w') as fd:
             json.dump(crossConnectJSON, fd, indent=4, separators=(',', ': '))
         info('*** Pushing crossConnect.json to ONOS\n')
-        output = quietRun('%s/tools/test/bin/onos-netcfg %s\
-         Topology.json' % (self.onosDir, self.controllers[ 0 ].ip), shell=True)
+        output = quietRun('%s/onos-netcfg %s\
+         Topology.json' % (self.runPackDir, self.controllers[ 0 ].ip), shell=True)
 
     def stop_oe(self):
         '''
@@ -578,8 +584,8 @@
 
         info('*** Pushing Topology.json to ONOS\n')
         for index in range(len(LINCSwitch.controllers)):
-            output = quietRun('%s/tools/test/bin/onos-netcfg %s Topology.json &'\
-                               % (LINCSwitch.onosDir, LINCSwitch.controllers[ index ].ip), shell=True)
+            output = quietRun('%s/onos-netcfg %s Topology.json &'\
+                               % (LINCSwitch.runPackDir, LINCSwitch.controllers[ index ].ip), shell=True)
             # successful output contains the two characters '{}'
             # if there is more output than this, there is an issue
             if output.strip('{}'):