Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
HC Test: update URL paths
[csit.git]
/
resources
/
libraries
/
python
/
honeycomb
/
HcAPIKwInterfaces.py
diff --git
a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
index
a62cee8
..
b4746e2
100644
(file)
--- a/
resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
+++ b/
resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
@@
-1,4
+1,4
@@
-# Copyright (c) 201
6
Cisco and/or its affiliates.
+# Copyright (c) 201
7
Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@
-44,7
+44,7
@@
class InterfaceKeywords(object):
"temporary-valid-lifetime",
"temporary-preferred-lifetime")
ETH_PARAMS = ("mtu", )
"temporary-valid-lifetime",
"temporary-preferred-lifetime")
ETH_PARAMS = ("mtu", )
- ROUTING_PARAMS = ("
vrf-id",
)
+ ROUTING_PARAMS = ("
ipv4-vrf-id", "ipv6-vrf-id"
)
VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id")
L2_PARAMS = ("bridge-domain", "split-horizon-group",
"bridged-virtual-interface")
VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id")
L2_PARAMS = ("bridge-domain", "split-horizon-group",
"bridged-virtual-interface")
@@
-513,9
+513,9
@@
class InterfaceKeywords(object):
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
"address")
if isinstance(network, basestring):
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
"address")
if isinstance(network, basestring):
- address =
{"address": [{"ip": ip_addr, "netmask": network}, ]}
+ address =
[{"ip": ip_addr, "netmask": network}]
elif isinstance(network, int) and (0 < network < 33):
elif isinstance(network, int) and (0 < network < 33):
- address =
{"address": [{"ip": ip_addr, "prefix-length": network}, ]}
+ address =
[{"ip": ip_addr, "prefix-length": network}]
else:
raise HoneycombError("Value {0} is not a valid netmask or network "
"prefix length.".format(network))
else:
raise HoneycombError("Value {0} is not a valid netmask or network "
"prefix length.".format(network))
@@
-555,6
+555,9
@@
class InterfaceKeywords(object):
:rtype: bytearray
"""
:rtype: bytearray
"""
+ interface = Topology.convert_interface_reference(
+ node, interface, "name")
+
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
"neighbor")
neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
"neighbor")
neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
@@
-626,6
+629,9
@@
class InterfaceKeywords(object):
:rtype: bytearray
"""
:rtype: bytearray
"""
+ interface = Topology.convert_interface_reference(
+ node, interface, "name")
+
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6")
address = {"address": [{"ip": ip_addr, "prefix-length": prefix_len}, ]}
return InterfaceKeywords._set_interface_properties(
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6")
address = {"address": [{"ip": ip_addr, "prefix-length": prefix_len}, ]}
return InterfaceKeywords._set_interface_properties(
@@
-686,6
+692,9
@@
class InterfaceKeywords(object):
:rtype: bytearray
"""
:rtype: bytearray
"""
+ interface = Topology.convert_interface_reference(
+ node, interface, "name")
+
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
"neighbor")
neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
"neighbor")
neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
@@
-752,6
+761,9
@@
class InterfaceKeywords(object):
:raises HoneycombError: If the parameter is not valid.
"""
:raises HoneycombError: If the parameter is not valid.
"""
+ interface = Topology.convert_interface_reference(
+ node, interface, "name")
+
if param not in InterfaceKeywords.ROUTING_PARAMS:
raise HoneycombError("The parameter {0} is invalid.".format(param))
if param not in InterfaceKeywords.ROUTING_PARAMS:
raise HoneycombError("The parameter {0} is invalid.".format(param))
@@
-1248,8
+1260,8
@@
class InterfaceKeywords(object):
"information about the tag-rewrite.")
@staticmethod
"information about the tag-rewrite.")
@staticmethod
- def add_ip
v4
_address_to_sub_interface(node, super_interface, identifier,
-
ip_addr, network
):
+ def add_ip_address_to_sub_interface(node, super_interface, identifier,
+
ip_addr, network, ip_version
):
"""Add an ipv4 address to the specified sub-interface, with the provided
netmask or network prefix length. Any existing ipv4 addresses on the
sub-interface will be replaced.
"""Add an ipv4 address to the specified sub-interface, with the provided
netmask or network prefix length. Any existing ipv4 addresses on the
sub-interface will be replaced.
@@
-1259,11
+1271,13
@@
class InterfaceKeywords(object):
:param identifier: The ID of sub-interface.
:param ip_addr: IPv4 address to be set.
:param network: Network mask or network prefix length.
:param identifier: The ID of sub-interface.
:param ip_addr: IPv4 address to be set.
:param network: Network mask or network prefix length.
+ :param ip_version: ipv4 or ipv6
:type node: dict
:type super_interface: str
:type identifier: int
:type ip_addr: str
:type network: str or int
:type node: dict
:type super_interface: str
:type identifier: int
:type ip_addr: str
:type network: str or int
+ :type ip_version: string
:returns: Content of response.
:rtype: bytearray
:raises HoneycombError: If the provided netmask or prefix is not valid.
:returns: Content of response.
:rtype: bytearray
:raises HoneycombError: If the provided netmask or prefix is not valid.
@@
-1273,9
+1287,9
@@
class InterfaceKeywords(object):
("interface", "name", super_interface),
"vpp-vlan:sub-interfaces",
("sub-interface", "identifier", int(identifier)),
("interface", "name", super_interface),
"vpp-vlan:sub-interfaces",
("sub-interface", "identifier", int(identifier)),
-
"ipv4"
)
+
ip_version.lower()
)
- if isinstance(network, basestring):
+ if isinstance(network, basestring)
and ip_version.lower() == "ipv4"
:
address = {"address": [{"ip": ip_addr, "netmask": network}, ]}
elif isinstance(network, int) and 0 < network < 33:
address = {"address": [{"ip": ip_addr, "netmask": network}, ]}
elif isinstance(network, int) and 0 < network < 33:
@@
-1289,16
+1303,18
@@
class InterfaceKeywords(object):
node, super_interface, path, address)
@staticmethod
node, super_interface, path, address)
@staticmethod
- def remove_all_ip
v4
_addresses_from_sub_interface(node, super_interface,
-
identifier
):
+ def remove_all_ip_addresses_from_sub_interface(node, super_interface,
+
identifier, ip_version
):
"""Remove all ipv4 addresses from the specified sub-interface.
:param node: Honeycomb node.
:param super_interface: Super interface.
:param identifier: The ID of sub-interface.
"""Remove all ipv4 addresses from the specified sub-interface.
:param node: Honeycomb node.
:param super_interface: Super interface.
:param identifier: The ID of sub-interface.
+ :param ip_version: ipv4 or ipv6
:type node: dict
:type super_interface: str
:type identifier: int
:type node: dict
:type super_interface: str
:type identifier: int
+ :type ip_version: string
:returns: Content of response.
:rtype: bytearray
"""
:returns: Content of response.
:rtype: bytearray
"""
@@
-1307,7
+1323,7
@@
class InterfaceKeywords(object):
("interface", "name", super_interface),
"vpp-vlan:sub-interfaces",
("sub-interface", "identifier", int(identifier)),
("interface", "name", super_interface),
"vpp-vlan:sub-interfaces",
("sub-interface", "identifier", int(identifier)),
-
"ipv4"
, "address")
+
str(ip_version)
, "address")
return InterfaceKeywords._set_interface_properties(
node, super_interface, path, None)
return InterfaceKeywords._set_interface_properties(
node, super_interface, path, None)
@@
-1460,7
+1476,7
@@
class InterfaceKeywords(object):
interface = interface.replace("/", "%2F")
data = {
interface = interface.replace("/", "%2F")
data = {
- "v
3po
:acl": {
+ "v
pp-interface-acl
:acl": {
"ingress": {
"ip4-acl": {
"classify-table": table_name
"ingress": {
"ip4-acl": {
"classify-table": table_name
@@
-1472,7
+1488,7
@@
class InterfaceKeywords(object):
}
}
}
}
- path = "/interface/" + interface + "/v
3po
:acl"
+ path = "/interface/" + interface + "/v
pp-interface-acl
:acl"
status_code, resp = HcUtil.\
put_honeycomb_data(node, "config_vpp_interfaces", data, path,
data_representation=DataRepresentation.JSON)
status_code, resp = HcUtil.\
put_honeycomb_data(node, "config_vpp_interfaces", data, path,
data_representation=DataRepresentation.JSON)
@@
-1498,7
+1514,7
@@
class InterfaceKeywords(object):
interface = interface.replace("/", "%2F")
interface = interface.replace("/", "%2F")
- path = "/interface/" + interface + "/v
3po
:acl"
+ path = "/interface/" + interface + "/v
pp-interface-acl
:acl"
status_code, resp = HcUtil.\
delete_honeycomb_data(node, "config_vpp_interfaces", path)
status_code, resp = HcUtil.\
delete_honeycomb_data(node, "config_vpp_interfaces", path)
@@
-1528,7
+1544,7
@@
class InterfaceKeywords(object):
"""
interface = intf.replace("/", "%2F")
"""
interface = intf.replace("/", "%2F")
- path = "/interface/{0}/pbb-rewrite
/
".format(interface)
+ path = "/interface/{0}/pbb-rewrite".format(interface)
status_code, resp = HcUtil. \
put_honeycomb_data(node, "config_vpp_interfaces", params, path,
data_representation=DataRepresentation.JSON)
status_code, resp = HcUtil. \
put_honeycomb_data(node, "config_vpp_interfaces", params, path,
data_representation=DataRepresentation.JSON)