CORD-866 make test case username/password configurable

Change-Id: I102c06b1c0aa4cc96bd9425cafabce0199400af9
diff --git a/xos/grpc/protos/Makefile b/xos/grpc/protos/Makefile
index aeee046..771a4bc 100644
--- a/xos/grpc/protos/Makefile
+++ b/xos/grpc/protos/Makefile
@@ -84,5 +84,5 @@
 rebuild-protos:
 	cd ../../tools/apigen && python ./modelgen -a "*" protobuf.template.txt > /opt/xos/grpc/protos/xos.proto  
 	cd ../../tools/apigen && python ./modelgen -a "*" grpc_api.template.py > /opt/xos/grpc/xos_grpc_api.py  
-	cd ../../tools/apigen && python ./modelgen -a "*" grpc_list_test.template.py > /opt/xos/grpc/list_test.py
+	cd ../../tools/apigen && python ./modelgen -a "*" grpc_list_test.template.py > /opt/xos/grpc/tests/list_test.py
 	cd ../../tools/apigen && python ./modelgen -a "*" chameleon_list_test.template.sh > /opt/xos/grpc/tests/chameleon_list_test.sh
diff --git a/xos/grpc/tests/api_user_crud.py b/xos/grpc/tests/api_user_crud.py
index ee455fa..2e84f7f 100644
--- a/xos/grpc/tests/api_user_crud.py
+++ b/xos/grpc/tests/api_user_crud.py
@@ -2,11 +2,12 @@
 sys.path.append("..")
 
 import grpc_client
+from testconfig import *
 
 print "api_user_crud"
 
 #c=grpc_client.InsecureClient("localhost")
-c=grpc_client.SecureClient("xos-core.cord.lab", username="padmin@vicci.org", password="letmein")
+c=grpc_client.SecureClient("xos-core.cord.lab", username=USERNAME, password=PASSWORD)
 u=grpc_client.User()
 import random, string
 u.email=''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
diff --git a/xos/grpc/tests/cham_slice_crud.sh b/xos/grpc/tests/cham_slice_crud.sh
index bc7259a..4b3714b 100644
--- a/xos/grpc/tests/cham_slice_crud.sh
+++ b/xos/grpc/tests/cham_slice_crud.sh
@@ -1,6 +1,6 @@
-source /opt/xos/grpc/tests/chamconfig.sh
+source /opt/xos/grpc/tests/testconfig-chameleon.sh
 
-RESPONSE=`curl -X POST -H "Content-Type: application/json" -d '{"username": "padmin@vicci.org", "password": "letmein"}' http://$HOSTNAME:8080/xosapi/v1/utility/login`
+RESPONSE=`curl -X POST -H "Content-Type: application/json" -d "{\"username\": \"$USERNAME\", \"$PASSWORD\"}" http://$HOSTNAME:8080/xosapi/v1/utility/login`
 SESSIONID=`echo $RESPONSE | python -c "import json,sys; print json.load(sys.stdin)['sessionid']"`
 echo "sessionid=$SESSIONID"
 
@@ -9,14 +9,14 @@
 
 echo "slicename=$SLICENAME"
 
-RESPONSE=`curl -X POST -H "x-xossession: $SESSIONID" -H "Content-Type: application/json" -d "{\"name\": \"$SLICENAME\", \"site_id\": 1}" http://$HOSTNAME:8080/xosapi/v1/slices`

-

-echo "create response: $RESPONSE"

-SLICEID=`echo $RESPONSE | python -c "import json,sys; print json.load(sys.stdin)['id']"`

-

-RESPONSE=`curl -X GET -H "x-xossession: $SESSIONID" http://$HOSTNAME:8080/xosapi/v1/slices/$SLICEID`

-echo "get response: $RESPONSE"

-

-RESPONSE=`curl -X DELETE -H "x-xossession: $SESSIONID" http://$HOSTNAME:8080/xosapi/v1/slices/$SLICEID`

-

-echo "delete response: $RESPONSE"

+RESPONSE=`curl -X POST -H "x-xossession: $SESSIONID" -H "Content-Type: application/json" -d "{\"name\": \"$SLICENAME\", \"site_id\": 1}" http://$HOSTNAME:8080/xosapi/v1/slices`
+
+echo "create response: $RESPONSE"
+SLICEID=`echo $RESPONSE | python -c "import json,sys; print json.load(sys.stdin)['id']"`
+
+RESPONSE=`curl -X GET -H "x-xossession: $SESSIONID" http://$HOSTNAME:8080/xosapi/v1/slices/$SLICEID`
+echo "get response: $RESPONSE"
+
+RESPONSE=`curl -X DELETE -H "x-xossession: $SESSIONID" http://$HOSTNAME:8080/xosapi/v1/slices/$SLICEID`
+
+echo "delete response: $RESPONSE"
diff --git a/xos/grpc/tests/chamconfig.sh b/xos/grpc/tests/chamconfig.sh
deleted file mode 100644
index b2eaa31..0000000
--- a/xos/grpc/tests/chamconfig.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# enter your hostname here:
-
-HOSTNAME=my_hostname
\ No newline at end of file
diff --git a/xos/grpc/tests/orm_user_crud.py b/xos/grpc/tests/orm_user_crud.py
index 6eda2b5..424a39d 100644
--- a/xos/grpc/tests/orm_user_crud.py
+++ b/xos/grpc/tests/orm_user_crud.py
@@ -2,10 +2,11 @@
 sys.path.append("..")
 
 import grpc_client
+from testconfig import *
 
 print "orm_user_crud"
 
-c=grpc_client.SecureClient("xos-core.cord.lab", username="padmin@vicci.org", password="letmein")
+c=grpc_client.SecureClient("xos-core.cord.lab", username=USERNAME, password=PASSWORD)
 
 # create a new user and save it
 u=c.xos_orm.User.objects.new()
diff --git a/xos/grpc/tests/testconfig-chameleon.sh b/xos/grpc/tests/testconfig-chameleon.sh
new file mode 100644
index 0000000..8e35d13
--- /dev/null
+++ b/xos/grpc/tests/testconfig-chameleon.sh
@@ -0,0 +1,5 @@
+# enter your hostname and credentials here
+
+HOSTNAME=my_hostname
+USERNAME=xosadmin@opencord.org
+PASSWORD=my_password
diff --git a/xos/grpc/tests/testconfig.py b/xos/grpc/tests/testconfig.py
new file mode 100644
index 0000000..0b15953
--- /dev/null
+++ b/xos/grpc/tests/testconfig.py
@@ -0,0 +1,2 @@
+USERNAME="xosadmin@opencord.org"
+PASSWORD="mypassword"
diff --git a/xos/tools/apigen/chameleon_list_test.template.sh b/xos/tools/apigen/chameleon_list_test.template.sh
index c3297f3..3884401 100644
--- a/xos/tools/apigen/chameleon_list_test.template.sh
+++ b/xos/tools/apigen/chameleon_list_test.template.sh
@@ -1,4 +1,4 @@
-source /opt/xos/grpc/tests/chamconfig.sh
+source /opt/xos/grpc/tests/testconfig-chameleon.sh
 
 # test modeldefs
 curl -f --silent http://$HOSTNAME:8080/xosapi/v1/modeldefs > /dev/null
diff --git a/xos/tools/apigen/grpc_list_test.template.py b/xos/tools/apigen/grpc_list_test.template.py
index 4b00219..9891c5e 100644
--- a/xos/tools/apigen/grpc_list_test.template.py
+++ b/xos/tools/apigen/grpc_list_test.template.py
@@ -1,5 +1,6 @@
 import grpc_client
 from grpc_client import Empty
+from testconfig import *
 
 c=grpc_client.InsecureClient("xos-core.cord.lab")
 
@@ -9,7 +10,7 @@
 print "Okay"
 {%- endfor %}
 
-c=grpc_client.SecureClient("xos-core.cord.lab", username="padmin@vicci.org", password="letmein")
+c=grpc_client.SecureClient("xos-core.cord.lab", username=USERNAME, password=PASSWORD)
 
 {% for object in generator.all() %}
 print "testing basic secure List{{ object.camel() }}...",
@@ -20,8 +21,8 @@
 # now try to login
 c=grpc_client.InsecureClient("xos-core.cord.lab")
 lr=grpc_client.LoginRequest()
-lr.username="padmin@vicci.org"
-lr.password="letmein"
+lr.username=USERNAME
+lr.password=PASSWORD
 session=c.utility.Login(lr)
 
 c=grpc_client.SecureClient("xos-core.cord.lab", sessionid=session.sessionid)