Skip to content
Snippets Groups Projects
Commit 7ffdb1d8 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos
Browse files

Add network-related opcodes


Add opcodes for network addition and query.

Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
parent 427746af
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,9 @@ _PTags = ("tags", ht.NoDefault, ht.TListOf(ht.TNonEmptyString))
#: Ignore consistency
_PIgnoreConsistency = ("ignore_consistency", False, ht.TBool)
#: a required network name
_PNetworkName = ("network_name", ht.NoDefault, ht.TNonEmptyString)
#: OP_ID conversion regular expression
_OPID_RE = re.compile("([a-z])([A-Z])")
......@@ -1286,6 +1289,26 @@ class OpTestDummy(OpCode):
WITH_LU = False
# Network opcodes
class OpNetworkAdd(OpCode):
"""Add an IP network to the cluster."""
OP_DSC_FIELD = "network_name"
OP_PARAMS = [
_PNetworkName,
("network", None, ht.TString),
("gateway", None, ht.TMaybeString),
("reserved_ips", None, ht.TOr(ht.TListOf(ht.TNonEmptyString), ht.TNone)),
]
class OpNetworkQuery(OpCode):
"""Compute the list of networks."""
OP_PARAMS = [
_POutputFields,
("names", ht.EmptyList, ht.TListOf(ht.TNonEmptyString)),
]
def _GetOpList():
"""Returns list of all defined opcodes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment