SEBA-282 Update xos-tosca to use latest xosgenx
Change-Id: I73e628e331a69ba71014360162b18541f46f826e
diff --git a/Dockerfile b/Dockerfile
index c1ed397..e4f2354 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
# docker build -t xosproject/xos-tosca:candidate .
# xosproject/xos-tosca
-FROM xosproject/xos-client:2.1.17
+FROM xosproject/xos-client:2.1.18
# Set environment variables
ENV CODE_SOURCE .
diff --git a/VERSION b/VERSION
index 45a1b3f..781dcb0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.2
+1.1.3
diff --git a/src/tosca/generator.py b/src/tosca/generator.py
index 0e36952..1c2dccb 100644
--- a/src/tosca/generator.py
+++ b/src/tosca/generator.py
@@ -19,12 +19,9 @@
import os
from default import TOSCA_DEFS_DIR, TOSCA_KEYS_DIR
-from xosgenx.generator import XOSProcessor
+from xosgenx.generator import XOSProcessor, XOSProcessorArgs
from xosapi.xos_grpc_client import Empty
-class Args:
- verbosity = 0
-
current_dir = os.path.dirname(os.path.realpath(__file__))
class TOSCA_Generator:
@@ -45,11 +42,10 @@
try:
xproto = client.utility.GetXproto(Empty())
- args = Args()
- args.output = TOSCA_DEFS_DIR
- args.inputs = str(xproto.xproto)
- args.target = os.path.join(current_dir, 'xtarget/tosca.xtarget')
- args.write_to_file = 'target'
+ args = XOSProcessorArgs(output = TOSCA_DEFS_DIR,
+ inputs = str(xproto.xproto),
+ target = os.path.join(current_dir, 'xtarget/tosca.xtarget'),
+ write_to_file = 'target')
XOSProcessor.process(args)
log.info("[XOS-TOSCA] Recipes generated in %s" % args.output)
except Exception as e:
@@ -57,14 +53,12 @@
try:
xproto = client.utility.GetXproto(Empty())
- args = Args()
- args.output = TOSCA_KEYS_DIR
- args.inputs = str(xproto.xproto)
- args.target = os.path.join(current_dir, 'xtarget/tosca_keys.xtarget')
- args.write_to_file = 'single'
- args.dest_file = 'KEYS.py'
+ args = XOSProcessorArgs(output = TOSCA_KEYS_DIR,
+ inputs = str(xproto.xproto),
+ target = os.path.join(current_dir, 'xtarget/tosca_keys.xtarget'),
+ write_to_file = 'single',
+ dest_file = 'KEYS.py')
XOSProcessor.process(args)
log.info("[XOS-TOSCA] TOSCA Keys generated in %s" % args.output)
except Exception as e:
log.exception("[XOS-TOSCA] Failed to generate TOSCA Keys")
-
diff --git a/test/test_tosca_generator.py b/test/test_tosca_generator.py
index 45c3cc0..f76dce5 100644
--- a/test/test_tosca_generator.py
+++ b/test/test_tosca_generator.py
@@ -16,15 +16,12 @@
from helpers import *
import unittest
import os
-from xosgenx.generator import XOSProcessor
+from xosgenx.generator import XOSProcessor, XOSProcessorArgs
current_dir = os.path.dirname(os.path.realpath(__file__))
OUTPUT_DIR = os.path.join(current_dir, 'out');
print OUTPUT_DIR
-class FakeArgs:
- verbosity = 0
-
class TOSCA_Generator_Test(unittest.TestCase):
def test_generate_basic_tosca(self):
@@ -42,13 +39,12 @@
required string files = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "List of comma separated file composing the view", null = False, db_index = False];
}
"""
- args = FakeArgs()
- args.inputs = xproto
- args.target = os.path.join(current_dir, '../src/tosca/xtarget/tosca.xtarget')
- args.output = OUTPUT_DIR
- args.write_to_file = "single"
- args.dest_file = "basic.yaml"
- args.quiet = False
+ args = XOSProcessorArgs(inputs = xproto,
+ target = os.path.join(current_dir, '../src/tosca/xtarget/tosca.xtarget'),
+ output = OUTPUT_DIR,
+ write_to_file = "single",
+ dest_file = "basic.yaml",
+ quiet = False)
output = XOSProcessor.process(args)
self.assertIn("name:", output)
self.assertIn("files:", output)
@@ -71,12 +67,11 @@
required string prop = 1 [max_length = 200, content_type = "stripped", blank = False, null = False, db_index = False];
}
"""
- args = FakeArgs()
- args.inputs = xproto
- args.target = os.path.join(current_dir, '../src/tosca/xtarget/tosca.xtarget')
- args.output = OUTPUT_DIR
- args.write_to_file = 'target'
- args.quiet = False
+ args = XOSProcessorArgs(inputs = xproto,
+ target = os.path.join(current_dir, '../src/tosca/xtarget/tosca.xtarget'),
+ output = OUTPUT_DIR,
+ write_to_file = 'target',
+ quiet = False)
output = XOSProcessor.process(args)
self.assertEqual(output.count("name:"), 4)
self.assertIn("prop:", output)