@@ -25,6 +25,7 @@ class InstallNode(WorkerImpl):
2525 from frinx_api .uniconfig .connection .manager .installnode import Cli
2626 from frinx_api .uniconfig .connection .manager .installnode import Gnmi
2727 from frinx_api .uniconfig .connection .manager .installnode import Netconf
28+ from frinx_api .uniconfig .connection .manager .installnode import Snmp
2829 from frinx_api .uniconfig .rest_api import InstallNode as UniconfigApi
2930
3031 class ExecutionProperties (TaskExecutionProperties ):
@@ -37,7 +38,7 @@ class WorkerDefinition(TaskDefinition):
3738
3839 class WorkerInput (TaskInput ):
3940 node_id : str
40- connection_type : Literal ["netconf" , "cli" , "gnmi" ]
41+ connection_type : Literal ["netconf" , "cli" , "gnmi" , "snmp" ]
4142 install_params : DictAny
4243 uniconfig_url_base : str = UNICONFIG_URL_BASE
4344 # todo: remove this flag after low-quality Pydantic code is fixed
@@ -65,6 +66,9 @@ def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
6566 gnmi = self .Gnmi (** worker_input .install_params )
6667 if worker_input .connection_type == "gnmi"
6768 else None ,
69+ snmp = self .Snmp (** worker_input .install_params )
70+ if worker_input .connection_type == "snmp"
71+ else None ,
6872 ),
6973 ),
7074 )
@@ -80,6 +84,8 @@ def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
8084 data ["input" ]["netconf" ] = worker_input .install_params
8185 elif worker_input .connection_type == "gnmi" :
8286 data ["input" ]["gnmi" ] = worker_input .install_params
87+ elif worker_input .connection_type == "snmp" :
88+ data ["input" ]["snmp" ] = worker_input .install_params
8389 import json
8490 data = json .dumps (data )
8591
@@ -108,7 +114,7 @@ class WorkerDefinition(TaskDefinition):
108114
109115 class WorkerInput (TaskInput ):
110116 node_id : str
111- connection_type : Literal ["netconf" , "cli" , "gnmi" ]
117+ connection_type : Literal ["netconf" , "cli" , "gnmi" , "snmp" ]
112118 uniconfig_url_base : str = UNICONFIG_URL_BASE
113119
114120 class WorkerOutput (TaskOutput ):
@@ -313,7 +319,7 @@ class WorkerInput(TaskInput):
313319 """
314320 Identifier of the node in the UniConfig network topology.
315321 """
316- connection_type : Literal ["netconf" , "cli" , "gnmi" ]
322+ connection_type : Literal ["netconf" , "cli" , "gnmi" , "snmp" ]
317323 """
318324 Type of connection to the device.
319325 """
@@ -357,11 +363,13 @@ def execute(self, worker_input: WorkerInput) -> TaskResult[WorkerOutput]:
357363 return handle_response (response , self .WorkerOutput )
358364
359365 @staticmethod
360- def _derive_topology_id (connection_type : Literal ["netconf" , "cli" , "gnmi" ]) -> str :
366+ def _derive_topology_id (connection_type : Literal ["netconf" , "cli" , "gnmi" , "snmp" ]) -> str :
361367 if connection_type == "netconf" :
362368 return "topology-netconf"
363369 if connection_type == "cli" :
364370 return "cli"
365371 if connection_type == "gnmi" :
366372 return "gnmi-topology"
373+ if connection_type == "snmp" :
374+ return "topology-snmp"
367375 raise ValueError (f"Unknown connection type { connection_type } " )
0 commit comments