Skip to content
Snippets Groups Projects
Commit be9d4f39 authored by lavado's avatar lavado
Browse files

Merge branch 'hackfest9' into 'master'

Fix enodeb charm: run daemon

See merge request !13
parents ed1e5e44 aec484fa
No related branches found
No related tags found
1 merge request!13Fix enodeb charm: run daemon
charm-helpers @ 8a90d2cc
Subproject commit 8a90d2cc3aa0ba170756bdc87b4499903ac86fe5
charms.osm @ 623ba0d8
Subproject commit 623ba0d8e6d3ff7a01067a0e09f15fc98ef6bec5
operator @ a3918e1d
Subproject commit a3918e1db40edac88a5250c46d7ef3156e8853d3
File added
......@@ -28,7 +28,10 @@ import subprocess
import logging
import asyncio
import random
logger = logging.getLogger(__name__)
class EnodebCharm(CharmBase):
state = StoredState()
def __init__(self, *args):
......@@ -93,7 +96,7 @@ class EnodebCharm(CharmBase):
process = self._run_daemon(command, log_file)
logger.debug("Register action: executed")
event.set_results(
{"status": "ok", "pid": process.pid, "log_file": log_file}
{"status": "ok", "pid": process.pid, "log-file": log_file}
)
except subprocess.CalledProcessError as e:
event.fail("Command error: {}".format(e.output))
......@@ -114,9 +117,11 @@ class EnodebCharm(CharmBase):
event.fail("Command error: {}".format(e.output))
except Exception as e:
event.fail(e)
def _run_daemon(self, cmd, stdout_file):
with open(stdout_file, "wb") as f:
return subprocess.Popen(cmd, shell=True, stdout=f)
def on_attach_ue_action(self, event):
"""Attach User Emulator to EnodeB."""
try:
......@@ -142,7 +147,7 @@ class EnodebCharm(CharmBase):
process = self._run_daemon(command, log_file)
logger.debug("Attach UE action: executed")
event.set_results(
{"status": "ok", "pid": process.pid, "log_file": log_file}
{"status": "ok", "pid": process.pid, "log-file": log_file}
)
except subprocess.CalledProcessError as ex:
event.fail(ex)
......
Subproject commit cf167cf041a3d4ca9b8dd90e9f575c9c4e99b8ad
Subproject commit 623ba0d8e6d3ff7a01067a0e09f15fc98ef6bec5
......@@ -3,7 +3,6 @@ password: osm2020
chpasswd: { expire: False }
ssh_pwauth: True
runcmd:
- route delete -net 0.0.0.0/0 gw 172.21.251.254
- route add -net 10.0.0.0/8 gw 172.21.251.254
- route add -net 172.21.0.0/16 gw 172.21.251.254
- route add -net 172.22.0.0/16 gw 172.21.251.254
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment