daemon: updates to provide config types for configurable values, without the need to specify the enumerated type

This commit is contained in:
Blake Harnden 2021-11-15 16:40:30 -08:00
parent bd3e2f5d0e
commit 22e92111d0
10 changed files with 115 additions and 240 deletions

View file

@ -1,13 +1,12 @@
import pytest
from core.config import (
ConfigString,
ConfigurableManager,
ConfigurableOptions,
Configuration,
ModelManager,
)
from core.emane.models.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.enumerations import ConfigDataTypes
from core.emulator.session import Session
from core.location.mobility import BasicRangeModel
from core.nodes.network import WlanNode
@ -16,10 +15,7 @@ from core.nodes.network import WlanNode
class TestConfigurableOptions(ConfigurableOptions):
name1 = "value1"
name2 = "value2"
options = [
Configuration(id=name1, type=ConfigDataTypes.STRING, label=name1),
Configuration(id=name2, type=ConfigDataTypes.STRING, label=name2),
]
options = [ConfigString(id=name1, label=name1), ConfigString(id=name2, label=name2)]
class TestConf:

View file

@ -3,13 +3,12 @@ from unittest import mock
import pytest
from core.config import Configuration
from core.config import ConfigBool, ConfigString
from core.configservice.base import (
ConfigService,
ConfigServiceBootError,
ConfigServiceMode,
)
from core.emulator.enumerations import ConfigDataTypes
from core.errors import CoreCommandError, CoreError
TEMPLATE_TEXT = "echo hello"
@ -27,13 +26,10 @@ class MyService(ConfigService):
shutdown = [f"pkill {files[0]}"]
validation_mode = ConfigServiceMode.BLOCKING
default_configs = [
Configuration(id="value1", type=ConfigDataTypes.STRING, label="Text"),
Configuration(id="value2", type=ConfigDataTypes.BOOL, label="Boolean"),
Configuration(
id="value3",
type=ConfigDataTypes.STRING,
label="Multiple Choice",
options=["value1", "value2", "value3"],
ConfigString(id="value1", label="Text"),
ConfigBool(id="value2", label="Boolean"),
ConfigString(
id="value3", label="Multiple Choice", options=["value1", "value2", "value3"]
),
]
modes = {