lib/ruby_nsx_cli/nsx_objects/nsx_edge.rb
def check_dhcp_agent_exists(xml, vnic_index, gi_address)
      doc = Nokogiri::XML(xml)
      agents = doc.css('relayAgent')

      agents.each do |agent|
        agent_vnic_index = agent.css('vnicIndex').text
        agent_gi_address = agent.css('giAddress').text
        if vnic_index == agent_vnic_index && gi_address == agent_gi_address
          return true
        end
      end

      return false
    end
# Checks if a DHCP relay agent already exists within the specified XML document
#
# @param xml [String] XML document to check for the DHCP agent
# @param vnic_index [String] vNIC index of the DHCP agent on the edge it is attached to
# @param gi_address [String] Gateway IP address for the DHCP agent
# @return [Boolean] True if the agent exists; otherwise false
Checks if a DHCP relay agent already exists within the specified XML document
Checks if a DHCP relay agent already exists within the specified XML document
def check_dhcp_agent_exists(xml, vnic_index, gi_address)
      doc = Nokogiri::XML(xml)
      agents = doc.css('relayAgent')
      agents.each do |agent|
        agent_vnic_index = agent.css('vnicIndex').text
        agent_gi_address = agent.css('giAddress').text
        if vnic_index == agent_vnic_index && gi_address == agent_gi_address
          return true
        end
      end
      return false
    end
def check_dhcp_agent_exists ( xml , vnic_index , gi_address ) doc = Nokogiri :: XML ( xml ) agents = doc . css ( 'relayAgent' ) agents . each do | agent | agent_vnic_index = agent . css ( 'vnicIndex' ) . text agent_gi_address = agent . css ( 'giAddress' ) . text if vnic_index == agent_vnic_index && gi_address == agent_gi_address return true end end return false end
Checks if a DHCP relay agent already exists within the specified XML document
Checks if a DHCP relay agent already exists within the specified XML document
True if the agent exists; otherwise false
True if the agent exists ; otherwise false
Boolean
xml
XML document to check for the DHCP agent
XML document to check for the DHCP agent
vnic_index
vNIC index of the DHCP agent on the edge it is attached to
vNIC index of the DHCP agent on the edge it is attached to
gi_address
Gateway IP address for the DHCP agent
Gateway IP address for the DHCP agent