[CORD-1840] Fixing grpc connection
Change-Id: Idb42e5bc23c81de2d8cdcae7aca7e51350f00a89
diff --git a/Makefile b/Makefile
index 2d6b101..41b3f2e 100644
--- a/Makefile
+++ b/Makefile
@@ -21,10 +21,10 @@
docker rmi -f xosproject/xos-tosca || true
test-create:
- curl -H "xos-username: xosadmin@opencord.org" -H "xos-password: rk1UYDHZXbu6KVCMkhmV" -X POST --data-binary @test/tosca/test.yaml 127.0.0.1:9200/run
+ curl -H "xos-username: xosadmin@opencord.org" -H "xos-password: rk1UYDHZXbu6KVCMkhmV" -X POST --data-binary @test/tosca/test.yaml 127.0.0.1:9102/run
test-delete:
- curl -H "xos-username: xosadmin@opencord.org" -H "xos-password: rk1UYDHZXbu6KVCMkhmV" -X POST --data-binary @test/tosca/test.yaml 127.0.0.1:9200/delete
+ curl -H "xos-username: xosadmin@opencord.org" -H "xos-password: rk1UYDHZXbu6KVCMkhmV" -X POST --data-binary @test/tosca/test.yaml 127.0.0.1:9102/delete
tosca:
xosgenx --target=src/tosca/xtarget/tosca.xtarget --output=src/tosca/custom_types --write-to-file=model --dest-extension=yaml ../xos/xos/core/models/core.xproto
\ No newline at end of file
diff --git a/src/grpc_client/main.py b/src/grpc_client/main.py
index 90ecc0b..aa13362 100644
--- a/src/grpc_client/main.py
+++ b/src/grpc_client/main.py
@@ -21,14 +21,17 @@
from xosconfig import Config
from twisted.internet import reactor
-LOCAL_CERT = '/Users/teone/Sites/opencord/orchestration/xos-tosca/local_certs.crt'
-
class GRPC_Client:
def __init__(self):
self.client = None
- self.grpc_secure_endpoint = Config.get('grpc.secure_endpoint')
- self.grpc_insecure_endpoint = Config.get('grpc.insecure_endpoint')
+ insecure = Config.get('gprc_endpoint')
+ secure = Config.get('gprc_endpoint')
+
+ self.grpc_secure_endpoint = secure + ":50051"
+ self.grpc_insecure_endpoint = insecure + ":50055"
+
+ print self.grpc_secure_endpoint, self.grpc_insecure_endpoint
def setup_resources(self, client, key, deferred, recipe):
print "[XOS-TOSCA] Loading resources"
@@ -63,7 +66,8 @@
if key in RESOURCES:
reactor.callLater(0, deferred.callback, recipe)
else:
- client = SecureClient(endpoint=self.grpc_secure_endpoint, username=username, password=password, cacert=LOCAL_CERT)
+ local_cert = Config.get('local_cert')
+ client = SecureClient(endpoint=self.grpc_secure_endpoint, username=username, password=password, cacert=local_cert)
client.set_reconnect_callback(functools.partial(self.setup_resources, client, key, deferred, recipe))
client.start()
return deferred
diff --git a/src/main.py b/src/main.py
index 2040977..1cb49a2 100644
--- a/src/main.py
+++ b/src/main.py
@@ -37,7 +37,6 @@
TOSCA_Generator().generate(client)
-
return deferred
def start(self):
diff --git a/src/tosca/generator.py b/src/tosca/generator.py
index 1d12a50..065170c 100644
--- a/src/tosca/generator.py
+++ b/src/tosca/generator.py
@@ -35,9 +35,10 @@
def generate(self, client):
print "[XOS-TOSCA] Generating TOSCA"
self._clean()
- xproto = client.utility.GetXproto(Empty())
+
try:
+ xproto = client.utility.GetXproto(Empty())
args = Args()
args.output = TOSCA_DEFS_DIR
args.inputs = str(xproto.xproto)
diff --git a/src/xos-tosca-config-schema.yaml b/src/xos-tosca-config-schema.yaml
index 483dc32..db68a43 100644
--- a/src/xos-tosca-config-schema.yaml
+++ b/src/xos-tosca-config-schema.yaml
@@ -18,24 +18,11 @@
name:
type: str
required: True
- grpc:
- type: map
- map:
- secure_endpoint:
- type: str
- required: True
- insecure_endpoint:
- type: str
- required: True
+ gprc_endpoint:
+ type: str
+ required: True
+ local_cert:
+ type: str
+ required: True
logging:
- type: map
- map:
- logstash_hostport:
- type: str
- level:
- type: str
- channels:
- type: seq
- sequence:
- - type: str
- enum: ['file', 'console', 'elkstack']
+ type: any
diff --git a/src/xos-tosca-config.yaml b/src/xos-tosca-config.yaml
index a69b33e..b5ebcbc 100644
--- a/src/xos-tosca-config.yaml
+++ b/src/xos-tosca-config.yaml
@@ -17,6 +17,21 @@
# NOTE in a deployment I'm overridden by platform install
name: xos-tosca
-grpc:
- secure_endpoint: "xos-core.opencord.org:50051"
- insecure_endpoint: "xos-core.opencord.org:50055"
+gprc_endpoint: "xos-core.cord.lab"
+local_cert: /usr/local/share/ca-certificates/local_certs.crt
+logging:
+ version: 1
+ handlers:
+ console:
+ class: logging.StreamHandler
+ file:
+ class: logging.handlers.RotatingFileHandler
+ filename: /var/log/xos.log
+ maxBytes: 10485760
+ backupCount: 5
+ loggers:
+ '':
+ handlers:
+ - console
+ - file
+ level: DEBUG