lib/ruby_nsx_cli/nsx_objects/nsx_virtualwire.rb
def create(name:, scope_id:, description:, tenant_id:, control_plane_mode:)

      @logger.info("Attempting to create new virtualwire (name: #{name}, scopeId: #{scope_id})")

      virtual_wire_hash = {
          :name => name,
          :description => description,
          :tenant_id => tenant_id || 'virtual wire tenant',
          :control_plane_mode => control_plane_mode || 'UNICAST_MODE'
      }

      validate_create_args(virtual_wire_hash, scope_id)

      @logger.info("Checking if virtualwire already exists (name: #{name}, scopeId: #{scope_id})")
      if (vwire_id = check_virtual_wire_exists(name, scope_id))
        @logger.info("Skipping virtualwire creation - virtual wire already exists (name: #{name}, scopeId: #{scope_id})")
        return vwire_id
      end

      @logger.info("Adding virtual wire (name: #{name}, scopeId: #{scope_id})")

      virtual_wire_obj = OpenStruct.new(virtual_wire_hash)
      api_endpoint = "/api/2.0/vdn/scopes/#{scope_id}/virtualwires"
      payload = render_template('/templates/virtualwire/virtualwire.xml.erb', virtual_wire_obj)

      post(:api_endpoint => api_endpoint, :payload => payload)
    end
# Creates an NSX virtualwire with the provided arguments
#
# @param name [String] Name of the virtualwire
# @param scope_id [String] vdnscope on which the virtualwire will be added to
# @param description [String] Optional description for the virtualwire
# @param tenant_id [String]
# @param control_plane_mode [String] one of 'UNICAST_MODE', 'MULTICAST_MODE', 'HYBRID_MODE'. Defaults to 'UNICAST_MODE'
# @return [String] virtualwire ID.
Creates an NSX virtualwire with the provided arguments
Creates an NSX virtualwire with the provided arguments
def create(name:, scope_id:, description:, tenant_id:, control_plane_mode:)
      @logger.info("Attempting to create new virtualwire (name: #{name}, scopeId: #{scope_id})")
      virtual_wire_hash = {
          :name => name,
          :description => description,
          :tenant_id => tenant_id || 'virtual wire tenant',
          :control_plane_mode => control_plane_mode || 'UNICAST_MODE'
      }
      validate_create_args(virtual_wire_hash, scope_id)
      @logger.info("Checking if virtualwire already exists (name: #{name}, scopeId: #{scope_id})")
      if (vwire_id = check_virtual_wire_exists(name, scope_id))
        @logger.info("Skipping virtualwire creation - virtual wire already exists (name: #{name}, scopeId: #{scope_id})")
        return vwire_id
      end
      @logger.info("Adding virtual wire (name: #{name}, scopeId: #{scope_id})")
      virtual_wire_obj = OpenStruct.new(virtual_wire_hash)
      api_endpoint = "/api/2.0/vdn/scopes/#{scope_id}/virtualwires"
      payload = render_template('/templates/virtualwire/virtualwire.xml.erb', virtual_wire_obj)
      post(:api_endpoint => api_endpoint, :payload => payload)
    end
def create ( name : , scope_id : , description : , tenant_id : , control_plane_mode : ) @logger . info ( "Attempting to create new virtualwire (name: #{name}, scopeId: #{scope_id})" ) virtual_wire_hash = { :name => name , :description => description , :tenant_id => tenant_id || 'virtual wire tenant' , :control_plane_mode => control_plane_mode || 'UNICAST_MODE' } validate_create_args ( virtual_wire_hash , scope_id ) @logger . info ( "Checking if virtualwire already exists (name: #{name}, scopeId: #{scope_id})" ) if ( vwire_id = check_virtual_wire_exists ( name , scope_id ) ) @logger . info ( "Skipping virtualwire creation - virtual wire already exists (name: #{name}, scopeId: #{scope_id})" ) return vwire_id end @logger . info ( "Adding virtual wire (name: #{name}, scopeId: #{scope_id})" ) virtual_wire_obj = OpenStruct . new ( virtual_wire_hash ) api_endpoint = "/api/2.0/vdn/scopes/#{scope_id}/virtualwires" payload = render_template ( '/templates/virtualwire/virtualwire.xml.erb' , virtual_wire_obj ) post ( :api_endpoint => api_endpoint , :payload => payload ) end
Creates an NSX virtualwire with the provided arguments
Creates an NSX virtualwire with the provided arguments
None
String
name
Name of the virtualwire
Name of the virtualwire
scope_id
vdnscope on which the virtualwire will be added to
vdnscope on which the virtualwire will be added to
description
Optional description for the virtualwire
Optional description for the virtualwire
tenant_id
control_plane_mode
one of 'UNICAST_MODE', 'MULTICAST_MODE', 'HYBRID_MODE'. Defaults to 'UNICAST_MODE'
one of ' UNICAST_MODE ' ' MULTICAST_MODE ' ' HYBRID_MODE ' . Defaults to ' UNICAST_MODE '
None