<commit_before>Puppet::Type.type(:quagga_bgp_router).provide :quagga do
  @doc = %q{ Manages as-path access-list using quagga }

  commands :vtysh => 'vtysh'

  @resource_map = {
      :import_check => {
          :default  => :false,
          :regexp   => /\A\sbgp\snetwork\simport-check\Z/,
          :template => 'bgp network import-check',
          :type     => :boolean,
      },
      :default_ipv4_unicast => {
          :default  => :true,
          :regexp   => /\A\sno\sbgp\sdefault\sipv4-unicast\Z/,
          :template => 'bgp default ipv4-unicast',
          :type     => :boolean,
      },
      :default_local_preference => {
          :default  => 100,
          :regexp   => /\A\sbgp\sdefault\slocal-preference\s(\d+)\Z/,
          :template => 'bgp default local-preference<% unless value.nil? %> <%= value %><% end %>',
          :type     => :fixnum,
      },
      :redistribute => {
          :regexp   => /\A\sredistribute\s(.+)\Z/,
          :template => 'redistribute <%= value %>',
          :type     => :array,
          :default  => [],
      },
      :router_id => {
          :regexp   => /\A\sbgp\srouter-id\s(\d+\.\d+\.\d+\.\d+)\Z/,
          :template => 'bgp router-id<% unless value.nil? %> <%= value %><% end %>',
          :type     => :string,
      },
  }

  def initialize(value)
    super(value)
    @property_flush = {}
  end

  def self.default_router_id
    default_router_id = :absent
    begin
      vtysh('-c', 'show ip bgp summary').split(/\n/).collect.each do |line|
        if line =~ /\ABGP\srouter\sidentifier\s(\d+\.\d+\.\d+\.\d+),\slocal\sAS\snumber\s(\d+)\Z/
          default_router_id = $1
          break
        end
      end
    rescue
    end

    default_router_id
  end<commit_msg>Fixed getting a router-id<commit_after>Puppet::Type.type(:quagga_bgp_router).provide :quagga do
  @doc = %q{ Manages as-path access-list using quagga }

  commands :vtysh => 'vtysh'

  @resource_map = {
      :import_check => {
          :default  => :false,
          :regexp   => /\A\sbgp\snetwork\simport-check\Z/,
          :template => 'bgp network import-check',
          :type     => :boolean,
      },
      :default_ipv4_unicast => {
          :default  => :true,
          :regexp   => /\A\sno\sbgp\sdefault\sipv4-unicast\Z/,
          :template => 'bgp default ipv4-unicast',
          :type     => :boolean,
      },
      :default_local_preference => {
          :default  => 100,
          :regexp   => /\A\sbgp\sdefault\slocal-preference\s(\d+)\Z/,
          :template => 'bgp default local-preference<% unless value.nil? %> <%= value %><% end %>',
          :type     => :fixnum,
      },
      :redistribute => {
          :regexp   => /\A\sredistribute\s(.+)\Z/,
          :template => 'redistribute <%= value %>',
          :type     => :array,
          :default  => [],
      },
      :router_id => {
          :regexp   => /\A\sbgp\srouter-id\s(\d+\.\d+\.\d+\.\d+)\Z/,
          :template => 'bgp router-id<% unless value.nil? %> <%= value %><% end %>',
          :type     => :string,
      },
  }

  def initialize(value)
    super(value)
    @property_flush = {}
  end

  def self.default_router_id
    default_router_id = :absent
    begin
      vtysh('-c', 'show running-config').split(/\n/).collect.each do |line|
        if line =~ /\A\sbgp\srouter-id\s(\d+\.\d+\.\d+\.\d+)\Z/
          default_router_id = Integer($1)
          break
        end
      end
    rescue
    end

    default_router_id
  end
{'fraction_non_alphanumeric': 0.18270611893134156, 'fraction_numerical': 0.004021832806664752, 'mean_word_length': 1.767885532591415, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6712081', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1226, 'n_words': 202}