Add per-network service models
In part to address, Bug 585, this patch drops the use of the "default"
Juju model and instead creates a model per network service (which is
required to be passed to N2VC methods).
Change-Id: I31cfd56d71697066ff9c11df9c7607c791470cfa
Signed-off-by: Adam Israel <adam.israel@canonical.com>
diff --git a/tests/base.py b/tests/base.py
index 0959059..8b61461 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -65,9 +65,9 @@
logging.debug(
"[{}] {}".format(now.strftime('%Y-%m-%dT%H:%M:%S'), msg)
)
- # print(
- # "[{}] {}".format(now.strftime('%Y-%m-%dT%H:%M:%S'), msg)
- # )
+ print(
+ "[{}] {}".format(now.strftime('%Y-%m-%dT%H:%M:%S'), msg)
+ )
def get_charm_path():
@@ -432,9 +432,6 @@
self.ns_name = self.nsd['name']
self.vnf_name = self.vnfd['name']
- # Hard-coded to default for now, but this may change in the future.
- self.model = "default"
-
self.charms = {}
self.parse_vnf_descriptor()
assert self.charms is not {}
@@ -553,7 +550,7 @@
# Make sure the charm snap is installed
try:
subprocess.check_call(['which', 'charm'])
- except subprocess.CalledProcessError as e:
+ except subprocess.CalledProcessError:
raise Exception("charm snap not installed.")
if charm not in self.artifacts:
@@ -565,7 +562,7 @@
builds = get_charm_path()
if not os.path.exists("{}/builds/{}".format(builds, charm)):
- cmd = "charm build {}/{} -o {}/".format(
+ cmd = "charm build --no-local-layers {}/{} -o {}/".format(
get_layer_path(),
charm,
builds,
@@ -891,13 +888,13 @@
for application in self.charms:
try:
- await self.n2vc.RemoveCharms(self.model, application)
+ await self.n2vc.RemoveCharms(self.ns_name, application)
while True:
# Wait for the application to be removed
await asyncio.sleep(10)
if not await self.n2vc.HasApplication(
- self.model,
+ self.ns_name,
application,
):
break
@@ -962,7 +959,7 @@
)
await self.n2vc.ExecutePrimitive(
- self.model,
+ self.ns_name,
application,
"config",
None,
@@ -987,7 +984,7 @@
Re-run those actions so we can inspect the status.
"""
uuids = await self.n2vc.ExecuteInitialPrimitives(
- self.model,
+ self.ns_name,
application,
init_config,
)
@@ -1019,7 +1016,7 @@
debug("Collecting metrics for {}".format(application))
metrics = await self.n2vc.GetMetrics(
- self.model,
+ self.ns_name,
application,
)
@@ -1069,7 +1066,7 @@
debug("Getting status of {} ({})...".format(uid, status))
status = await self.n2vc.GetPrimitiveStatus(
- self.model,
+ self.ns_name,
uid,
)
debug("...state of {} is {}".format(uid, status))