Skip to content
Snippets Groups Projects
Commit 81cb5961 authored by Taya Snijder's avatar Taya Snijder
Browse files

Merge branch 'L2SS-852_create_pcon_device' into 'master'

L2SS-852: Create_pcon_device merge

Closes L2SS-852

See merge request !386
parents 772bbbd1 dc93d155
Branches
Tags
1 merge request!386L2SS-852: Create_pcon_device merge
Showing
with 1214 additions and 11 deletions
......@@ -101,6 +101,7 @@ docker_build_image_all:
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-observation latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-observation-control latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-psoc latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-pcon latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-recv latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-sdp latest
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-bst latest
......@@ -267,6 +268,17 @@ docker_build_image_device_psoc:
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-psoc $tag
docker_build_image_device_pcon:
extends: .base_docker_images_except
only:
refs:
- merge_requests
changes:
- docker-compose/device-pcon.yml
- docker-compose/lofar-device-base/*
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh device-pcon $tag
docker_build_image_device_tilebeam:
extends: .base_docker_images_except
only:
......
......@@ -46,9 +46,9 @@
"PSOC": {
"STAT/PSOC/1": {
"properties": {
"SNMP_host": ["10.87.2.145"],
"SNMP_host": ["127.0.0.1"],
"SNMP_community": ["public"],
"SNMP_mib_dir": ["devices/psoc_mib/PowerNet-MIB.mib"],
"SNMP_mib_dir": ["devices/mibs/PowerNet-MIB.mib"],
"SNMP_timeout": ["10.0"],
"SNMP_version": ["1"],
"PSOC_sockets": [
......@@ -66,6 +66,21 @@
}
}
},
"PCON": {
"STAT": {
"PCON": {
"STAT/PCON/1": {
"properties": {
"SNMP_host": ["127.0.0.1"],
"SNMP_community": ["public"],
"SNMP_mib_dir": ["devices/mibs/ACC-MIB.mib"],
"SNMP_timeout": ["10.0"],
"SNMP_version": ["1"]
}
}
}
}
},
"TemperatureManager": {
"STAT": {
"TemperatureManager": {
......
......@@ -526,6 +526,38 @@
}
}
},
"PSOC": {
"STAT": {
"PSOC": {
"STAT/PSOC/1": {
"properties": {
"SNMP_host": ["10.87.2.145"],
"PSOC_sockets": [
"socket_1",
"socket_2",
"socket_3",
"socket_4",
"socket_5",
"socket_6",
"socket_7",
"socket_8"
]
}
}
}
}
},
"PCON": {
"STAT": {
"PCON": {
"STAT/PCON/1": {
"properties": {
"SNMP_host": ["10.151.225.5"]
}
}
}
}
},
"UNB2": {
"STAT": {
"UNB2": {
......
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
volumes:
iers-data: {}
services:
device-pcon:
image: device-pcon
# build explicitly, as docker-compose does not understand a local image
# being shared among services.
build:
context: ..
dockerfile: docker-compose/lofar-device-base/Dockerfile
args:
SOURCE_IMAGE: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-itango:${TANGO_ITANGO_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}device-pcon
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
ports:
- "5719:5719" # unique port for this DS
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint:
- bin/start-ds.sh
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- l2ss-pcon pcon STAT -v -ORBendPoint giop:tcp:device-pcon:5719 -ORBendPointPublish giop:tcp:${HOSTNAME}:5719
restart: unless-stopped
......@@ -31,6 +31,8 @@
},
"STAT/PSOC/1": {
},
"STAT/PCON/1": {
},
"STAT/RECV/1": {
"include": [
"ANT_mask_RW",
......
......@@ -69,7 +69,8 @@ sleep 1 # dsconfig container must be up and running...
# shellcheck disable=SC2016
echo '/usr/local/bin/wait-for-it.sh ${TANGO_HOST} --strict --timeout=300 -- true' | make run dsconfig bash -
DEVICES="device-boot device-apsct device-apspu device-sdp device-recv device-bst device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam device-psoc device-antennafield device-temperature-manager device-observation device-observation-control"
DEVICES="device-boot device-apsct device-apspu device-sdp device-recv device-bst device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam device-psoc device-pcon device-antennafield device-temperature-manager device-observation device-observation-control"
SIMULATORS="sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim"
# Build only the required images, please do not build everything that makes CI
......
......@@ -37,6 +37,7 @@ console_scripts =
l2ss-apsct = tangostationcontrol.devices.apsct:main
l2ss-apspu = tangostationcontrol.devices.apspu:main
l2ss-psoc = tangostationcontrol.devices.psoc:main
l2ss-pcon = tangostationcontrol.devices.pcon:main
l2ss-tilebeam = tangostationcontrol.devices.tilebeam:main
l2ss-beamlet = tangostationcontrol.devices.sdp.beamlet:main
l2ss-digitalbeam = tangostationcontrol.devices.sdp.digitalbeam:main
......
......@@ -83,7 +83,10 @@ class SNMP_client(CommClient):
# SNMP has tables that require an index number to access them. regular non-table variable have an index of 0
idx = annotation.get('index', 0)
return mib, name, idx
# SNMP values like to use weird units like tenths of amps because its all integers. We added a scaling factor to correct for that.
scaling_factor = annotation.get('scaling_factor', 1)
return mib, name, idx, scaling_factor
except KeyError:
raise ValueError(f"SNMP attribute annotation requires a dict argument with both a 'name' and 'mib' key. Instead got: {annotation}")
......@@ -108,11 +111,11 @@ class SNMP_client(CommClient):
"""
# process the annotation
mib, name, idx = self._process_annotation(annotation)
mib, name, idx, scaling_factor = self._process_annotation(annotation)
# get all the necessary data to set up the read/write functions from the attribute_wrapper
dim_x, dim_y, dtype = self.setup_value_conversion(attribute)
snmp_attr = snmp_attribute(self.SNMP_comm, mib, name, idx, dtype, dim_x, dim_y)
snmp_attr = snmp_attribute(self.SNMP_comm, mib, name, idx, dtype, dim_x, dim_y, scaling_factor)
# return the read/write functions
def read_function():
......@@ -125,13 +128,14 @@ class SNMP_client(CommClient):
class snmp_attribute:
def __init__(self, comm: SNMP_comm, mib, name, idx, dtype, dim_x, dim_y):
def __init__(self, comm: SNMP_comm, mib, name, idx, dtype, dim_x, dim_y, scaling_factor=1):
self.comm = comm
self.mib = mib
self.name = name
self.idx = idx
self.dtype = dtype
self.scaling_factor = scaling_factor
self.len = self.get_len(dim_x, dim_y)
self.is_scalar = self.len == 1
......@@ -203,7 +207,7 @@ class snmp_attribute:
# IpAddress values get printed as their raw value but in hex (7F 20 20 01 for 127.0.0.1 for example)
vals.append(varBind[1].prettyPrint())
elif snmp_type is hlapi.Integer32 or snmp_type is hlapi.Integer and self.dtype == str:
elif (snmp_type is hlapi.Integer32 or snmp_type is hlapi.Integer) and self.dtype == str:
# Integers can have 'named values', Where a value can be translated to a specific name. A dict basically
# Example: {1: "other", 2: "invalid", 3: "dynamic", 4: "static",}
......@@ -215,7 +219,10 @@ class snmp_attribute:
vals.append(varBind[1].prettyPrint())
else:
# convert from the funky pysnmp types to numpy types and then append
vals.append(snmp_to_numpy_dict[snmp_type](varBind[1]))
value = snmp_to_numpy_dict[snmp_type](varBind[1])
# scale the value correctly and append.
vals.append(value * self.scaling_factor)
if self.is_scalar:
vals = vals[0]
......@@ -235,7 +242,5 @@ class mib_loader:
logger.debug(f"mib sources: {self.mibBuilder.getMibSources()}")
def load_pymib(self, mib_name):
logger.debug(f"test {self.mibBuilder.getMibSources()}")
logger.debug(f"test {mib_name}")
self.mibBuilder.loadModules(mib_name)
......@@ -235,6 +235,7 @@ class Boot(lofar_device):
mandatory=False,
default_value=["STAT/Docker/1", # Docker controls the device containers, so it goes before anything else
"STAT/PSOC/1", # PSOC boot early to detect power delivery failure as fast as possible
"STAT/PCON/1", # PCON boot early because it is responsible for power delivery.
"STAT/APSPU/1", # APS Power Units control other hardware we want to initialise
"STAT/APSCT/1",
"STAT/RECV/1", # RCUs are input for SDP, so initialise them first
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment