class VRouter5600
Class that represents a VRouter 5600 device.
Public Instance Methods
Create a firewall on the VRouter5600.
Parameters
firewall
-
Firewall : firewall object describing the firewall to be created.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ).
# File lib/netconfdev/vrouter/vrouter5600.rb, line 117 def create_firewall_instance(firewall) raise ArgumentError, "Firewall must be instance of 'Firewall'" unless firewall.is_a?(Firewall) post_uri = @controller.get_ext_mount_config_uri(self) response = @controller.rest_agent.post_request(post_uri, firewall.to_hash, headers: {'Content-Type' => 'application/yang.data+json'}) check_response_for_success(response) do NetconfResponse.new(NetconfResponseStatus::OK) end end
Delete both inbound and outbound firewalls for a dataplane interface on the VRouter 5600.
Parameters
interface_name
-
String : name of the dataplane interface to detach firewalls from.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and error details (if status is error).
# File lib/netconfdev/vrouter/vrouter5600.rb, line 292 def delete_dataplane_interface_firewall(interface_name) delete_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-interfaces:interfaces/vyatta-interfaces-dataplane:dataplane/" "#{interface_name}/vyatta-security-firewall:firewall" response = @controller.rest_agent.delete_request(delete_uri) if response.code.to_i == 200 NetconfResponse.new(NetconfResponseStatus::OK) else handle_error_response(response) end end
Delete a firewall from the VRouter5600.
Parameters
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and error info if an error.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 134 def delete_firewall_instance(firewall_or_name) firewall_name = firewall_or_name.is_a?(Firewall) ? firewall_or_name.rules.name : firewall_or_name delete_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-security:security/vyatta-security-firewall:firewall/name/" "#{firewall_name}" response = @controller.rest_agent.delete_request(delete_uri) if response.code.to_i == 200 NetconfResponse.new(NetconfResponseStatus::OK) else handle_error_response(response) end end
Return configuration of the VRouter5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and configuration of VRouter5600.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 69 def get_cfg get_uri = @controller.get_ext_mount_config_uri(self) response = @controller.rest_agent.get_request(get_uri) check_response_for_success(response) do |body| NetconfResponse.new(NetconfResponseStatus::OK, body) end end
Return the configuration for a dataplane interface on the VRouter5600
Parameters
interface_name
-
String : name of the dataplane interface from get_dataplane_interfaces_list
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and configuration of the requested dataplane interface.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 194 def get_dataplane_interface_cfg(interface_name) get_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-interfaces:interfaces/vyatta-interfaces-dataplane:dataplane/" "#{interface_name}" response = @controller.rest_agent.get_request(get_uri) check_response_for_success(response) do |body| NetconfResponse.new(NetconfResponseStatus::OK, body) end end
Return the configuration for the dataplane interfaces on the VRouter5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and the configuration of the dataplane interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 174 def get_dataplane_interfaces_cfg response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) && body['interfaces'].has_key?('vyatta-interfaces-dataplane:dataplane') NetconfResponse.new(NetconfResponseStatus::OK, body['interfaces']['vyatta-interfaces-dataplane:dataplane']) else NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND) end end end
Return a list of interfaces on the VRouter5600
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and a list of datapath interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 153 def get_dataplane_interfaces_list response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) && body['interfaces'].has_key?('vyatta-interfaces-dataplane:dataplane') dp_interface_list = [] body['interfaces']['vyatta-interfaces-dataplane:dataplane'].each do |interface| dp_interface_list << interface['tagnode'] end NetconfResponse.new(NetconfResponseStatus::OK, dp_interface_list) else NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND) end end end
Return configuration for a specific firewall on the VRouter5600.
Parameters
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and configuration of requested firewall.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 98 def get_firewall_instance_cfg(firewall_or_name) firewall_name = firewall_or_name.is_a?(Firewall) ? firewall_or_name.rules.name : firewall_or_name get_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-security:security/vyatta-security-firewall:firewall/name/" "#{firewall_name}" response = @controller.rest_agent.get_request(get_uri) check_response_for_success(response) do |body| NetconfResponse.new(NetconfResponseStatus::OK, body) end end
Return firewall configuration of the VRouter5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and Firewall configuration JSON.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 82 def get_firewalls_cfg get_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-security:security/vyatta-security-firewall:firewall" response = @controller.rest_agent.get_request(get_uri) check_response_for_success(response) do |body| NetconfResponse.new(NetconfResponseStatus::OK, body) end end
Return the configuration for the interfaces on the VRouter 5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and configuration for interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 331 def get_interfaces_cfg response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) NetconfResponse.new(NetconfResponseStatus::OK, body) else NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND) end end end
Get the list of interfaces on the VRouter 5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and list of all interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 309 def get_interfaces_list response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) if_list = [] body['interfaces'].each do |if_name, interfaces| interfaces.each do |interface| if_list << interface['tagnode'] end end NetconfResponse.new(NetconfResponseStatus::OK, if_list) else NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND) end end end
Return the configuration for a single loopback interface on the VRouter 5600.
Parameters
interface_name
-
String : name of the loopback interface from the get_loopback_interfaces_list
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and configuration for the requested loopback interface.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 248 def get_loopback_interface_cfg(interface_name) get_uri = "#{@controller.get_ext_mount_config_uri(self)}/" "vyatta-interfaces:interfaces/vyatta-interfaces-loopback:loopback/" "#{interface_name}" response = @controller.rest_agent.get_request(get_uri) check_response_for_success(response) do |body| NetconfResponse.new(NetconfResponseStatus::OK, body) end end
Return the configuration for the loopback interfaces on the VRouter 5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and list of configurations of loopback interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 230 def get_loopback_interfaces_cfg response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) && body['interfaces'].has_key?('vyatta-interfaces-loopback:loopback') NetconfResponse.new(NetconfResponseStatus::OK, body['interfaces']['vyatta-interfaces-loopback:loopback']) end end end
Return a list of loopback interfaces on the VRouter5600
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and list of loopback interfaces.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 209 def get_loopback_interfaces_list response = get_interfaces_config check_response_for_success(response) do |body| if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash) && body['interfaces'].has_key?('vyatta-interfaces-loopback:loopback') lb_interface_list = [] body['interfaces']['vyatta-interfaces-loopback:loopback'].each do |interface| lb_interface_list << interface['tagnode'] end NetconfResponse.new(NetconfResponseStatus::OK, lb_interface_list) else NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND) end end end
Return a YANG schema for the indicated schema on the VRouter5600.
Parameters
id
-
String : Identifier for schema
version
-
String : Version/date for schema
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and YANG schema.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 57 def get_schema(id: nil, version: nil) raise ArgumentError, "Identifier (id) required" unless id raise ArgumentError, "Version (version) required" unless version @controller.get_schema(@name, id: id, version: version) end
Return a list of YANG schemas for this VRouter5600.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and list of YANG schemas for the node.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 45 def get_schemas @controller.get_schemas(@name) end
Set a firewall for inbound, outbound or both for a dataplane interface on the VRouter 5600.
Parameters
interface_name
-
String : The dataplane interface to attach firewalls.
inbound_firewall_name
-
String : [optional] name of firewall on VRouter5600 to use for traffic inbound towards router.
outbound_firewall_name
-
String : [optional] name of firewall on VRouter5600 to use for traffic outbound from router.
Return Value
-
NetconfResponse : Status ( NetconfResponseStatus ) and YANG schema.
# File lib/netconfdev/vrouter/vrouter5600.rb, line 267 def set_dataplane_interface_firewall(interface_name, inbound_firewall_name: nil, outbound_firewall_name: nil) raise ArgumentError, "At least one firewall (inbound_firewall_name, " "outbound_firewall_name) required" unless inbound_firewall_name || outbound_firewall_name dpif = DataplaneFirewall.new(interface_name: interface_name, in_firewall_name: inbound_firewall_name, out_firewall_name: outbound_firewall_name) put_uri = "#{@controller.get_ext_mount_config_uri(self)}/#{dpif.get_uri}" response = @controller.rest_agent.put_request(put_uri, dpif.to_hash, headers: {'Content-Type' => 'application/yang.data+json'}) if response.code.to_i == 200 NetconfResponse.new(NetconfResponseStatus::OK) else handle_error_response(response) end end