Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cirque/home/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(self, home_id=None):
self.home_id = home_id
self.home = {'home_id': self.home_id, 'devices': {}}
self.thread_petitions = {}
self.external_lan = HomeLan('{}_external'.format(self.home_id))
self.external_lan = HomeLan('cirque_home_{}_external'.format(self.home_id))
self.internal_lan = HomeLan(
'{}_internal'.format(self.home_id), internal=True)
'cirque_home_{}_internal'.format(self.home_id), internal=True)

self.logger = CirqueLog.get_cirque_logger('home')

Expand Down
14 changes: 10 additions & 4 deletions cirque/nodes/dockernode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
from functools import reduce

import docker
import string
import random
import time
from cirque.common.cirquelog import CirqueLog
from cirque.common.utils import sleep_time

CIRQUE_CONTAINER_PREFIX = "cirque_home_"


class DockerNode:
def __init__(self, docker_client, node_type,
Expand Down Expand Up @@ -54,11 +59,12 @@ def merge_capapblity_arg(arg0, arg1):
capability_run_args = [capability.get_docker_run_args(
self) for capability in self.capabilities]
capability_run_args = reduce(
merge_capapblity_arg, capability_run_args, {})
merge_capapblity_arg, capability_run_args,
{'cap_add': ['SYS_TIME']})
random.seed(time.time())
kwargs.update({"name", "{}.{}".format(CIRQUE_CONTAINER_PREFIX, ''.join(
random.choices(string.ascii_lowercase + string.digits, k=10)))})
kwargs.update(capability_run_args)
kwargs.update({
"cap_add": ["SYS_TIME"]
})
self.container = self._client.containers.run(
self.image_name, detach=True, **kwargs)
self.logger.info(
Expand Down
10 changes: 9 additions & 1 deletion cirque/nodes/wifiapnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import os
import time
import random
import string

from subprocess import PIPE

Expand All @@ -29,6 +30,7 @@

RUNTIME_NAMESPACE = "/var/run/netns"
CHAR_SRC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"
CIRQUE_CONTAINER_PREFIX = "cirque_home_ap_"


class WiFiAPNode(DockerNode):
Expand All @@ -41,7 +43,13 @@ def __init__(self, docker_client, ssid=None,
random.seed(time.time())
self.ssid = ssid
self.password = password
self.container_name = container_name

if container_name:
self.container_name = container_name
else:
self.container_name = "{}.{}".format(
CIRQUE_CONTAINER_PREFIX, ''.join(
random.choices(string.ascii_uppercase + string.digits, k=10)))
self.wifi_capability = WiFiCapability()
self.capabilities.append(self.wifi_capability)
if not self.ssid:
Expand Down