Commit f78e7625 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component:

- Enhanced management of setting DEVICE_EMULATED_ONLY
- Removed unused imports
parent dbf52a02
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12,3 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.


import os

TRUE_VALUES = {'T', 'TRUE', 'YES', '1'}
DEVICE_EMULATED_ONLY = os.environ.get('DEVICE_EMULATED_ONLY')
LOAD_ALL_DEVICE_DRIVERS = (DEVICE_EMULATED_ONLY is None) or (DEVICE_EMULATED_ONLY.upper() not in TRUE_VALUES)
+1 −4
Original line number Diff line number Diff line
@@ -18,15 +18,12 @@ from common.Settings import get_service_port_grpc
from common.proto.device_pb2_grpc import add_DeviceServiceServicer_to_server
from common.proto.openconfig_device_pb2_grpc import add_OpenConfigServiceServicer_to_server
from common.tools.service.GenericGrpcService import GenericGrpcService
from device.Config import LOAD_ALL_DEVICE_DRIVERS
from .driver_api.DriverInstanceCache import DriverInstanceCache
from .DeviceServiceServicerImpl import DeviceServiceServicerImpl
from .monitoring.MonitoringLoops import MonitoringLoops
from .OpenConfigServicer import OpenConfigServicer

TRUE_VALUES = {'T', 'TRUE', 'YES', '1'}
DEVICE_EMULATED_ONLY = os.environ.get('DEVICE_EMULATED_ONLY')
LOAD_ALL_DEVICE_DRIVERS = (DEVICE_EMULATED_ONLY is None) or (DEVICE_EMULATED_ONLY.upper() not in TRUE_VALUES)

# Custom gRPC settings
# Multiple clients might keep connections alive waiting for RPC methods to be executed.
# Requests needs to be serialized to ensure correct device configurations
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ from context.client.ContextClient import ContextClient
from .driver_api._Driver import _Driver
from .driver_api.DriverInstanceCache import DriverInstanceCache, get_driver
from .monitoring.MonitoringLoops import MonitoringLoops
from .drivers.oc_driver.OCDriver import OCDriver
from .ErrorMessages import ERROR_MISSING_DRIVER, ERROR_MISSING_KPI
from .Tools import (
    check_connect_rules, check_no_endpoints, compute_rules_to_add_delete, configure_rules, deconfigure_rules,
+1 −4
Original line number Diff line number Diff line
@@ -15,12 +15,9 @@
import os
from common.DeviceTypes import DeviceTypeEnum
from common.proto.context_pb2 import DeviceDriverEnum
from device.Config import LOAD_ALL_DEVICE_DRIVERS
from ..driver_api.FilterFields import FilterFieldEnum

TRUE_VALUES = {'T', 'TRUE', 'YES', '1'}
DEVICE_EMULATED_ONLY = os.environ.get('DEVICE_EMULATED_ONLY')
LOAD_ALL_DEVICE_DRIVERS = (DEVICE_EMULATED_ONLY is None) or (DEVICE_EMULATED_ONLY.upper() not in TRUE_VALUES)

DRIVERS = []

from .emulated.EmulatedDriver import EmulatedDriver # pylint: disable=wrong-import-position