-# Copyright (c) 2016 Cisco and/or its affiliates.
+# Copyright (c) 2017 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:
: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}, ]
: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(
: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}, ]
: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))
"information about the tag-rewrite.")
@staticmethod
- def add_ipv4_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.
: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 ip_version: string
:returns: Content of response.
:rtype: bytearray
:raises HoneycombError: If the provided netmask or prefix is not valid.
("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:
node, super_interface, path, address)
@staticmethod
- def remove_all_ipv4_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.
+ :param ip_version: ipv4 or ipv6
:type node: dict
:type super_interface: str
:type identifier: int
+ :type ip_version: string
:returns: Content of response.
:rtype: bytearray
"""
("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)
interface = interface.replace("/", "%2F")
data = {
- "v3po:acl": {
+ "vpp-interface-acl:acl": {
"ingress": {
"ip4-acl": {
"classify-table": table_name
}
}
- path = "/interface/" + interface + "/v3po:acl"
+ path = "/interface/" + interface + "/vpp-interface-acl:acl"
status_code, resp = HcUtil.\
put_honeycomb_data(node, "config_vpp_interfaces", data, path,
data_representation=DataRepresentation.JSON)
interface = interface.replace("/", "%2F")
- path = "/interface/" + interface + "/v3po:acl"
+ path = "/interface/" + interface + "/vpp-interface-acl:acl"
status_code, resp = HcUtil.\
delete_honeycomb_data(node, "config_vpp_interfaces", path)
"""
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)