1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 """Keywords to manipulate interface configuration using Honeycomb REST API.
16 The keywords make possible to put and get configuration data and to get
20 from resources.libraries.python.HTTPRequest import HTTPCodes
21 from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError
22 from resources.libraries.python.honeycomb.HoneycombUtil \
23 import DataRepresentation
24 from resources.libraries.python.honeycomb.HoneycombUtil \
25 import HoneycombUtil as HcUtil
28 # pylint: disable=too-many-public-methods
29 class InterfaceKeywords(object):
30 """Keywords for Interface manipulation.
32 Implements keywords which get configuration and operational data about
33 vpp interfaces and set the interface's parameters using Honeycomb REST API.
36 INTF_PARAMS = ("name", "description", "type", "enabled",
37 "link-up-down-trap-enable")
38 IPV4_PARAMS = ("enabled", "forwarding", "mtu")
39 IPV6_PARAMS = ("enabled", "forwarding", "mtu", "dup-addr-detect-transmits")
40 IPV6_AUTOCONF_PARAMS = ("create-global-addresses",
41 "create-temporary-addresses",
42 "temporary-valid-lifetime",
43 "temporary-preferred-lifetime")
44 ETH_PARAMS = ("mtu", )
45 ROUTING_PARAMS = ("vrf-id", )
46 VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id")
47 L2_PARAMS = ("bridge-domain", "split-horizon-group",
48 "bridged-virtual-interface")
49 TAP_PARAMS = ("tap-name", "mac", "device-instance")
50 VHOST_USER_PARAMS = ("socket", "role")
56 def _configure_interface(node, interface, data,
57 data_representation=DataRepresentation.JSON):
58 """Send interface configuration data and check the response.
60 :param node: Honeycomb node.
61 :param interface: The name of interface.
62 :param data: Configuration data to be sent in PUT request.
63 :param data_representation: How the data is represented.
67 :type data_representation: DataRepresentation
68 :return: Content of response.
70 :raises HoneycombError: If the status code in response on PUT is not
74 status_code, resp = HcUtil.\
75 put_honeycomb_data(node, "config_vpp_interfaces", data,
76 data_representation=data_representation)
77 if status_code != HTTPCodes.OK:
79 "The configuration of interface '{0}' was not successful. "
80 "Status code: {1}.".format(interface, status_code))
84 def get_all_interfaces_cfg_data(node):
85 """Get configuration data about all interfaces from Honeycomb.
87 :param node: Honeycomb node.
89 :return: Configuration data about all interfaces from Honeycomb.
91 :raises HoneycombError: If it is not possible to get configuration data.
94 status_code, resp = HcUtil.\
95 get_honeycomb_data(node, "config_vpp_interfaces")
96 if status_code != HTTPCodes.OK:
98 "Not possible to get configuration information about the "
99 "interfaces. Status code: {0}.".format(status_code))
101 return resp["interfaces"]["interface"]
103 except (KeyError, TypeError):
107 def get_interface_cfg_data(node, interface):
108 """Get configuration data about the given interface from Honeycomb.
110 :param node: Honeycomb node.
111 :param interface: The name of interface.
114 :return: Configuration data about the given interface from Honeycomb.
118 intfs = InterfaceKeywords.get_all_interfaces_cfg_data(node)
120 if intf["name"] == interface:
125 def get_all_interfaces_oper_data(node):
126 """Get operational data about all interfaces from Honeycomb.
128 :param node: Honeycomb node.
130 :return: Operational data about all interfaces from Honeycomb.
132 :raises HoneycombError: If it is not possible to get operational data.
135 status_code, resp = HcUtil.\
136 get_honeycomb_data(node, "oper_vpp_interfaces")
137 if status_code != HTTPCodes.OK:
138 raise HoneycombError(
139 "Not possible to get operational information about the "
140 "interfaces. Status code: {0}.".format(status_code))
142 return resp["interfaces-state"]["interface"]
144 except (KeyError, TypeError):
148 def get_interface_oper_data(node, interface):
149 """Get operational data about the given interface from Honeycomb.
151 :param node: Honeycomb node.
152 :param interface: The name of interface.
155 :return: Operational data about the given interface from Honeycomb.
159 intfs = InterfaceKeywords.get_all_interfaces_oper_data(node)
161 if intf["name"] == interface:
166 def _set_interface_properties(node, interface, path, new_value=None):
167 """Set interface properties.
169 This method reads interface configuration data, creates, changes or
170 removes the requested data and puts it back to Honeycomb.
172 :param node: Honeycomb node.
173 :param interface: The name of interface.
174 :param path: Path to data we want to change / create / remove.
175 :param new_value: The new value to be set. If None, the item will be
180 :type new_value: str, dict or list
181 :return: Content of response.
183 :raises HoneycombError: If it is not possible to get or set the data.
186 status_code, resp = HcUtil.\
187 get_honeycomb_data(node, "config_vpp_interfaces")
188 if status_code != HTTPCodes.OK:
189 raise HoneycombError(
190 "Not possible to get configuration information about the "
191 "interfaces. Status code: {0}.".format(status_code))
194 new_data = HcUtil.set_item_value(resp, path, new_value)
196 new_data = HcUtil.remove_item(resp, path)
197 return InterfaceKeywords._configure_interface(node, interface, new_data)
200 def set_interface_state(node, interface, state="up"):
201 """Set VPP interface state.
203 The keyword changes the administration state of interface to up or down
204 depending on the parameter "state".
206 :param node: Honeycomb node.
207 :param interface: The name of interface.
208 :param state: The requested state, only "up" and "down" are valid
213 :return: Content of response.
215 :raises KeyError: If the argument "state" is nor "up" or "down".
216 :raises HoneycombError: If the interface is not present on the node.
219 intf_state = {"up": "true",
222 path = ("interfaces", ("interface", "name", str(interface)), "enabled")
223 return InterfaceKeywords._set_interface_properties(
224 node, interface, path, intf_state[state.lower()])
227 def set_interface_up(node, interface):
228 """Set the administration state of VPP interface to up.
230 :param node: Honeycomb node.
231 :param interface: The name of interface.
234 :return: Content of response
238 return InterfaceKeywords.set_interface_state(node, interface, "up")
241 def set_interface_down(node, interface):
242 """Set the administration state of VPP interface to down.
244 :param node: Honeycomb node.
245 :param interface: The name of interface.
248 :return: Content of response.
252 return InterfaceKeywords.set_interface_state(node, interface, "down")
255 def add_bridge_domain_to_interface(node, interface, bd_name,
256 split_horizon_group=None, bvi=None):
257 """Add a new bridge domain to an interface and set its parameters.
259 :param node: Honeycomb node.
260 :param interface: The name of interface.
261 :param bd_name: Bridge domain name.
262 :param split_horizon_group: Split-horizon group name.
263 :param bvi: The bridged virtual interface.
267 :type split_horizon_group: str
269 :return: Content of response.
271 :raises HoneycombError: If the interface is not present on the node.
274 v3po_l2 = {"bridge-domain": str(bd_name)}
275 if split_horizon_group:
276 v3po_l2["split-horizon-group"] = str(split_horizon_group)
278 v3po_l2["bridged-virtual-interface"] = str(bvi)
280 path = ("interfaces", ("interface", "name", str(interface)), "v3po:l2")
282 return InterfaceKeywords._set_interface_properties(
283 node, interface, path, v3po_l2)
286 def configure_interface_base(node, interface, param, value):
287 """Configure the base parameters of interface.
289 :param node: Honeycomb node.
290 :param interface: The name of interface.
291 :param param: Parameter to configure (set, change, remove)
292 :param value: The value of parameter. If None, the parameter will be
298 :return: Content of response.
300 :raises HoneycombError: If the parameter is not valid.
303 if param not in InterfaceKeywords.INTF_PARAMS:
304 raise HoneycombError("The parameter {0} is invalid.".format(param))
306 path = ("interfaces", ("interface", "name", interface), param)
307 return InterfaceKeywords._set_interface_properties(
308 node, interface, path, value)
311 def configure_interface_ipv4(node, interface, param, value):
312 """Configure IPv4 parameters of interface
314 :param node: Honeycomb node.
315 :param interface: The name of interface.
316 :param param: Parameter to configure (set, change, remove)
317 :param value: The value of parameter. If None, the parameter will be
323 :return: Content of response.
325 :raises HoneycombError: If the parameter is not valid.
328 if param not in InterfaceKeywords.IPV4_PARAMS:
329 raise HoneycombError("The parameter {0} is invalid.".format(param))
331 path = ("interfaces", ("interface", "name", interface),
332 "ietf-ip:ipv4", param)
333 return InterfaceKeywords._set_interface_properties(
334 node, interface, path, value)
337 def add_first_ipv4_address(node, interface, ip_addr, network):
338 """Add the first IPv4 address.
340 If there are any other addresses configured, they will be removed.
342 :param node: Honeycomb node.
343 :param interface: The name of interface.
344 :param ip_addr: IPv4 address to be set.
345 :param network: Netmask or length of network prefix.
349 :type network: str or int
350 :return: Content of response.
354 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4")
355 if isinstance(network, basestring):
356 address = {"address": [{"ip": ip_addr, "netmask": network}, ]}
357 elif isinstance(network, int) and (0 < network < 33):
358 address = {"address": [{"ip": ip_addr, "prefix-length": network}, ]}
360 raise HoneycombError("Value {0} is not a valid netmask or network "
361 "prefix length.".format(network))
362 return InterfaceKeywords._set_interface_properties(
363 node, interface, path, address)
366 def add_ipv4_address(node, interface, ip_addr, network):
369 :param node: Honeycomb node.
370 :param interface: The name of interface.
371 :param ip_addr: IPv4 address to be set.
372 :param network: Netmask or length of network prefix.
376 :type network: str or int
377 :return: Content of response.
381 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
383 if isinstance(network, basestring):
384 address = {"address": [{"ip": ip_addr, "netmask": network}, ]}
385 elif isinstance(network, int) and (0 < network < 33):
386 address = {"address": [{"ip": ip_addr, "prefix-length": network}, ]}
388 raise HoneycombError("Value {0} is not a valid netmask or network "
389 "prefix length.".format(network))
390 return InterfaceKeywords._set_interface_properties(
391 node, interface, path, address)
394 def remove_all_ipv4_addresses(node, interface):
395 """Remove all IPv4 addresses from interface.
397 :param node: Honeycomb node.
398 :param interface: The name of interface.
401 :return: Content of response.
405 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
407 return InterfaceKeywords._set_interface_properties(
408 node, interface, path, None)
411 def add_first_ipv4_neighbor(node, interface, ip_addr, link_layer_address):
412 """Add the first IPv4 neighbour.
414 If there are any other neighbours configured, they will be removed.
416 :param node: Honeycomb node.
417 :param interface: The name of interface.
418 :param ip_addr: IPv4 address of neighbour to be set.
419 :param link_layer_address: Link layer address.
423 :type link_layer_address: str
424 :return: Content of response.
428 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4")
429 neighbor = {"neighbor": [{"ip": ip_addr,
430 "link-layer-address": link_layer_address}, ]}
431 return InterfaceKeywords._set_interface_properties(
432 node, interface, path, neighbor)
435 def add_ipv4_neighbor(node, interface, ip_addr, link_layer_address):
436 """Add the IPv4 neighbour.
438 :param node: Honeycomb node.
439 :param interface: The name of interface.
440 :param ip_addr: IPv4 address of neighbour to be set.
441 :param link_layer_address: Link layer address.
445 :type link_layer_address: str
446 :return: Content of response.
450 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
452 neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
453 return InterfaceKeywords._set_interface_properties(
454 node, interface, path, neighbor)
457 def remove_all_ipv4_neighbors(node, interface):
458 """Remove all IPv4 neighbours.
460 :param node: Honeycomb node.
461 :param interface: The name of interface.
464 :return: Content of response.
468 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv4",
470 return InterfaceKeywords._set_interface_properties(
471 node, interface, path, None)
474 def configure_interface_ipv6(node, interface, param, value):
475 """Configure IPv6 parameters of interface
477 :param node: Honeycomb node.
478 :param interface: The name of interface.
479 :param param: Parameter to configure (set, change, remove)
480 :param value: The value of parameter. If None, the parameter will be
486 :return: Content of response.
488 :raises HoneycombError: If the parameter is not valid.
491 if param in InterfaceKeywords.IPV6_PARAMS:
492 path = ("interfaces", ("interface", "name", interface),
493 "ietf-ip:ipv6", param)
494 elif param in InterfaceKeywords.IPV6_AUTOCONF_PARAMS:
495 path = ("interfaces", ("interface", "name", interface),
496 "ietf-ip:ipv6", "autoconf", param)
498 raise HoneycombError("The parameter {0} is invalid.".format(param))
500 return InterfaceKeywords._set_interface_properties(
501 node, interface, path, value)
504 def add_first_ipv6_address(node, interface, ip_addr, prefix_len):
505 """Add the first IPv6 address.
507 If there are any other addresses configured, they will be removed.
509 :param node: Honeycomb node.
510 :param interface: The name of interface.
511 :param ip_addr: IPv6 address to be set.
512 :param prefix_len: Prefix length.
516 :type prefix_len: str
517 :return: Content of response.
521 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6")
522 address = {"address": [{"ip": ip_addr, "prefix-length": prefix_len}, ]}
523 return InterfaceKeywords._set_interface_properties(
524 node, interface, path, address)
527 def add_ipv6_address(node, interface, ip_addr, prefix_len):
530 :param node: Honeycomb node.
531 :param interface: The name of interface.
532 :param ip_addr: IPv6 address to be set.
533 :param prefix_len: Prefix length.
537 :type prefix_len: str
538 :return: Content of response.
542 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
544 address = [{"ip": ip_addr, "prefix-length": prefix_len}, ]
545 return InterfaceKeywords._set_interface_properties(
546 node, interface, path, address)
549 def remove_all_ipv6_addresses(node, interface):
550 """Remove all IPv6 addresses from interface.
552 :param node: Honeycomb node.
553 :param interface: The name of interface.
556 :return: Content of response.
560 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
562 return InterfaceKeywords._set_interface_properties(
563 node, interface, path, None)
566 def add_first_ipv6_neighbor(node, interface, ip_addr, link_layer_address):
567 """Add the first IPv6 neighbour.
569 If there are any other neighbours configured, they will be removed.
571 :param node: Honeycomb node.
572 :param interface: The name of interface.
573 :param ip_addr: IPv6 address of neighbour to be set.
574 :param link_layer_address: Link layer address.
578 :type link_layer_address: str
579 :return: Content of response.
583 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6")
584 neighbor = {"neighbor": [{"ip": ip_addr,
585 "link-layer-address": link_layer_address}, ]}
586 return InterfaceKeywords._set_interface_properties(
587 node, interface, path, neighbor)
590 def add_ipv6_neighbor(node, interface, ip_addr, link_layer_address):
591 """Add the IPv6 neighbour.
593 :param node: Honeycomb node.
594 :param interface: The name of interface.
595 :param ip_addr: IPv6 address of neighbour to be set.
596 :param link_layer_address: Link layer address.
600 :type link_layer_address: str
601 :return: Content of response.
605 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
607 neighbor = [{"ip": ip_addr, "link-layer-address": link_layer_address}, ]
608 return InterfaceKeywords._set_interface_properties(
609 node, interface, path, neighbor)
612 def remove_all_ipv6_neighbors(node, interface):
613 """Remove all IPv6 neighbours.
615 :param node: Honeycomb node.
616 :param interface: The name of interface.
619 :return: Content of response.
623 path = ("interfaces", ("interface", "name", interface), "ietf-ip:ipv6",
625 return InterfaceKeywords._set_interface_properties(
626 node, interface, path, None)
629 def configure_interface_ethernet(node, interface, param, value):
630 """Configure the ethernet parameters of interface.
632 :param node: Honeycomb node.
633 :param interface: The name of interface.
634 :param param: Parameter to configure (set, change, remove)
635 :param value: The value of parameter. If None, the parameter will be
641 :return: Content of response.
643 :raises HoneycombError: If the parameter is not valid.
646 if param not in InterfaceKeywords.ETH_PARAMS:
647 raise HoneycombError("The parameter {0} is invalid.".format(param))
648 path = ("interfaces", ("interface", "name", interface), "v3po:ethernet",
650 return InterfaceKeywords._set_interface_properties(
651 node, interface, path, value)
654 def configure_interface_routing(node, interface, param, value):
655 """Configure the routing parameters of interface.
657 :param node: Honeycomb node.
658 :param interface: The name of interface.
659 :param param: Parameter to configure (set, change, remove)
660 :param value: The value of parameter. If None, the parameter will be
666 :return: Content of response.
668 :raises HoneycombError: If the parameter is not valid.
671 if param not in InterfaceKeywords.ROUTING_PARAMS:
672 raise HoneycombError("The parameter {0} is invalid.".format(param))
674 path = ("interfaces", ("interface", "name", interface), "v3po:routing",
676 return InterfaceKeywords._set_interface_properties(
677 node, interface, path, value)
680 def create_vxlan_interface(node, interface, **kwargs):
681 """Create a new VxLAN interface.
683 :param node: Honeycomb node.
684 :param interface: The name of interface.
685 :param kwargs: Parameters and their values. The accepted parameters are
686 defined in InterfaceKeywords.VXLAN_PARAMS.
690 :return: Content of response.
692 :raises HoneycombError: If the parameter is not valid.
697 "type": "v3po:vxlan-tunnel",
700 for param, value in kwargs.items():
701 if param not in InterfaceKeywords.VXLAN_PARAMS:
702 raise HoneycombError("The parameter {0} is invalid.".
704 new_vx_lan["v3po:vxlan"][param] = value
706 path = ("interfaces", "interface")
707 vx_lan_structure = [new_vx_lan, ]
708 return InterfaceKeywords._set_interface_properties(
709 node, interface, path, vx_lan_structure)
712 def delete_interface(node, interface):
713 """Delete an interface.
715 :param node: Honeycomb node.
716 :param interface: The name of interface.
719 :return: Content of response.
721 :raises HoneycombError: If it is not possible to get information about
722 interfaces or it is not possible to delete the interface.
725 path = ("interfaces", ("interface", "name", interface))
727 status_code, resp = HcUtil.\
728 get_honeycomb_data(node, "config_vpp_interfaces")
729 if status_code != HTTPCodes.OK:
730 raise HoneycombError(
731 "Not possible to get configuration information about the "
732 "interfaces. Status code: {0}.".format(status_code))
734 new_data = HcUtil.remove_item(resp, path)
735 status_code, resp = HcUtil.\
736 put_honeycomb_data(node, "config_vpp_interfaces", new_data)
737 if status_code != HTTPCodes.OK:
738 raise HoneycombError("Not possible to remove interface {0}. "
740 format(interface, status_code))
744 def configure_interface_vxlan(node, interface, **kwargs):
745 """Configure VxLAN on the interface.
747 The keyword configures VxLAN parameters on the given interface. The type
748 of interface must be set to "v3po:vxlan-tunnel".
749 The new VxLAN parameters overwrite the current configuration. If a
750 parameter in new configuration is missing, it is removed from VxLAN
752 If the dictionary kwargs is empty, VxLAN configuration is removed.
754 :param node: Honeycomb node.
755 :param interface: The name of interface.
756 :param kwargs: Parameters and their values. The accepted parameters are
757 defined in InterfaceKeywords.VXLAN_PARAMS.
761 :return: Content of response.
763 :raises HoneycombError: If the parameter is not valid.
766 vx_lan_structure = dict()
767 for param, value in kwargs.items():
768 if param not in InterfaceKeywords.VXLAN_PARAMS:
769 raise HoneycombError("The parameter {0} is invalid.".
771 vx_lan_structure[param] = value
773 path = ("interfaces", ("interface", "name", interface), "v3po:vxlan")
774 return InterfaceKeywords._set_interface_properties(
775 node, interface, path, vx_lan_structure)
778 def configure_interface_l2(node, interface, param, value):
779 """Configure the L2 parameters of interface.
781 :param node: Honeycomb node.
782 :param interface: The name of interface.
783 :param param: Parameter to configure (set, change, remove)
784 :param value: The value of parameter. If None, the parameter will be
790 :return: Content of response.
792 :raises HoneycombError: If the parameter is not valid.
795 if param not in InterfaceKeywords.L2_PARAMS:
796 raise HoneycombError("The parameter {0} is invalid.".format(param))
797 path = ("interfaces", ("interface", "name", interface), "v3po:l2",
799 return InterfaceKeywords._set_interface_properties(
800 node, interface, path, value)
803 def create_tap_interface(node, interface, **kwargs):
804 """Create a new TAP interface.
806 :param node: Honeycomb node.
807 :param interface: The name of interface.
808 :param kwargs: Parameters and their values. The accepted parameters are
809 defined in InterfaceKeywords.TAP_PARAMS.
813 :return: Content of response.
815 :raises HoneycombError: If the parameter is not valid.
823 for param, value in kwargs.items():
824 if param not in InterfaceKeywords.TAP_PARAMS:
825 raise HoneycombError("The parameter {0} is invalid.".
827 new_tap["v3po:tap"][param] = value
829 path = ("interfaces", "interface")
830 new_tap_structure = [new_tap, ]
831 return InterfaceKeywords._set_interface_properties(
832 node, interface, path, new_tap_structure)
835 def configure_interface_tap(node, interface, **kwargs):
836 """Configure TAP on the interface.
838 The keyword configures TAP parameters on the given interface. The type
839 of interface must be set to "v3po:tap".
840 The new TAP parameters overwrite the current configuration. If a
841 parameter in new configuration is missing, it is removed from TAP
843 If the dictionary kwargs is empty, TAP configuration is removed.
845 :param node: Honeycomb node.
846 :param interface: The name of interface.
847 :param kwargs: Parameters and their values. The accepted parameters are
848 defined in InterfaceKeywords.TAP_PARAMS.
852 :return: Content of response.
854 :raises HoneycombError: If the parameter is not valid.
857 tap_structure = dict()
858 for param, value in kwargs.items():
859 if param not in InterfaceKeywords.TAP_PARAMS:
860 raise HoneycombError("The parameter {0} is invalid.".
862 tap_structure[param] = value
864 path = ("interfaces", ("interface", "name", interface), "v3po:tap")
865 return InterfaceKeywords._set_interface_properties(
866 node, interface, path, tap_structure)
869 def configure_interface_vhost_user(node, interface, **kwargs):
870 """Configure vhost-user on the interface.
872 The keyword configures vhost-user parameters on the given interface.
873 The type of interface must be set to "v3po:vhost-user".
874 The new vhost-user parameters overwrite the current configuration. If a
875 parameter in new configuration is missing, it is removed from vhost-user
877 If the dictionary kwargs is empty, vhost-user configuration is removed.
879 :param node: Honeycomb node.
880 :param interface: The name of interface.
881 :param kwargs: Parameters and their values. The accepted parameters are
882 defined in InterfaceKeywords.VHOST_USER_PARAMS.
886 :return: Content of response.
888 :raises HoneycombError: If the parameter is not valid.
891 vhost_structure = dict()
892 for param, value in kwargs.items():
893 if param not in InterfaceKeywords.VHOST_USER_PARAMS:
894 raise HoneycombError("The parameter {0} is invalid.".
896 vhost_structure[param] = value
898 path = ("interfaces", ("interface", "name", interface),
900 return InterfaceKeywords._set_interface_properties(
901 node, interface, path, vhost_structure)
904 def create_vhost_user_interface(node, interface, **kwargs):
905 """Create a new vhost-user interface.
907 :param node: Honeycomb node.
908 :param interface: The name of interface.
909 :param kwargs: Parameters and their values. The accepted parameters are
910 defined in InterfaceKeywords.VHOST_USER_PARAMS.
914 :return: Content of response.
916 :raises HoneycombError: If the parameter is not valid.
921 "type": "v3po:vhost-user",
922 "v3po:vhost-user": {}
924 for param, value in kwargs.items():
925 if param not in InterfaceKeywords.VHOST_USER_PARAMS:
926 raise HoneycombError("The parameter {0} is invalid.".
928 new_vhost["v3po:vhost-user"][param] = value
930 path = ("interfaces", "interface")
931 new_vhost_structure = [new_vhost, ]
932 return InterfaceKeywords._set_interface_properties(
933 node, interface, path, new_vhost_structure)