class VRouter5600

Class that represents a VRouter 5600 device.

Public Instance Methods

create_firewall_instance(firewall) click to toggle source

Create a firewall on the VRouter5600.

Parameters

  • firewall

    Firewall : firewall object describing the firewall to be created.

Return Value

# 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_dataplane_interface_firewall(interface_name) click to toggle source

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

# 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_firewall_instance(firewall_or_name) click to toggle source

Delete a firewall from the VRouter5600.

Parameters

  • firewall_or_name

    Firewall or String : A Firewall object or name of firewall for which you want to remove from vRouter5600.

Return Value

# 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
get_cfg() click to toggle source

Return configuration of the VRouter5600.

Return Value

# 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
get_dataplane_interface_cfg(interface_name) click to toggle source

Return the configuration for a dataplane interface on the VRouter5600

Parameters

Return Value

# 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
get_dataplane_interfaces_cfg() click to toggle source

Return the configuration for the dataplane interfaces on the VRouter5600.

Return Value

# 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
get_dataplane_interfaces_list() click to toggle source

Return a list of interfaces on the VRouter5600

Return Value

# 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
get_firewall_instance_cfg(firewall_or_name) click to toggle source

Return configuration for a specific firewall on the VRouter5600.

Parameters

  • firewall_or_name

    Firewall or String : A Firewall object or name of firewall for which you want the configuration.

Return Value

# 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
get_firewalls_cfg() click to toggle source

Return firewall configuration of the VRouter5600.

Return Value

# 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
get_interfaces_cfg() click to toggle source

Return the configuration for the interfaces on the VRouter 5600.

Return Value

# 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_interfaces_list() click to toggle source

Get the list of interfaces on the VRouter 5600.

Return Value

# 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
get_loopback_interface_cfg(interface_name) click to toggle source

Return the configuration for a single loopback interface on the VRouter 5600.

Parameters

Return Value

# 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
get_loopback_interfaces_cfg() click to toggle source

Return the configuration for the loopback interfaces on the VRouter 5600.

Return Value

# 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
get_loopback_interfaces_list() click to toggle source

Return a list of loopback interfaces on the VRouter5600

Return Value

# 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
get_schema(id: nil, version: nil) click to toggle source

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

# 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
get_schemas() click to toggle source

Return a list of YANG schemas for this VRouter5600.

Return Value

# File lib/netconfdev/vrouter/vrouter5600.rb, line 45
def get_schemas
  @controller.get_schemas(@name)
end
set_dataplane_interface_firewall(interface_name, inbound_firewall_name: nil, outbound_firewall_name: nil) click to toggle source

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

# 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