<commit_before>package batfish.representation.cisco;

import java.io.Serializable;
import java.util.EnumMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;

import batfish.main.BatfishException;
import batfish.representation.Ip;
import batfish.representation.RoutingProtocol;

public class BgpProcess implements Serializable {

   private static final int DEFAULT_BGP_DEFAULT_METRIC = 0;
   private static final long serialVersionUID = 1L;

   private Map<BgpNetwork, Boolean> _aggregateNetworks;
   private Map<String, BgpPeerGroup> _allPeerGroups;
   private boolean _alwaysCompareMed;
   private Ip _clusterId;
   private Map<String, DynamicBgpPeerGroup> _dynamicPeerGroups;
   private Map<Ip, IpBgpPeerGroup> _ipPeerGroups;
   private MasterBgpPeerGroup _masterBgpPeerGroup;
   private Map<String, NamedBgpPeerGroup> _namedPeerGroups;
   private Set<BgpNetwork> _networks;
   private int _pid;
   private Map<RoutingProtocol, BgpRedistributionPolicy> _redistributionPolicies;
   private Ip _routerId;

   public BgpProcess(int procnum) {
      _pid = procnum;
      _allPeerGroups = new HashMap<String, BgpPeerGroup>();
      _dynamicPeerGroups = new HashMap<String, DynamicBgpPeerGroup>();
      _namedPeerGroups = new HashMap<String, NamedBgpPeerGroup>();
      _ipPeerGroups = new HashMap<Ip, IpBgpPeerGroup>();
      _networks = new LinkedHashSet<BgpNetwork>();
      _aggregateNetworks = new HashMap<BgpNetwork, Boolean>();
      _redistributionPolicies = new EnumMap<RoutingProtocol, BgpRedistributionPolicy>(
            RoutingProtocol.class);
      _masterBgpPeerGroup = new MasterBgpPeerGroup();
      _masterBgpPeerGroup.setDefaultMetric(DEFAULT_BGP_DEFAULT_METRIC);
   }

   public DynamicBgpPeerGroup addDynamicPeerGroup(Ip ip, int prefixLength,
         String name) {
      DynamicBgpPeerGroup pg = new DynamicBgpPeerGroup(ip, prefixLength, name);
      _dynamicPeerGroups.put(name, pg);
      _allPeerGroups.put(name, pg);
      return pg;
   }

   public void addIpPeerGroup(Ip ip) {
      IpBgpPeerGroup pg = new IpBgpPeerGroup(ip);
      _ipPeerGroups.put(ip, pg);
      _allPeerGroups.put(ip.toString(), pg);
   }

   public void addNamedPeerGroup(String name) {
      NamedBgpPeerGroup pg = new NamedBgpPeerGroup(name);
      _namedPeerGroups.put(name, pg);
      _allPeerGroups.put(name, pg);
   }

   public void addPeerGroupMember(Ip address, String namedPeerGroupName) {
      NamedBgpPeerGroup namedPeerGroup = _namedPeerGroups
            .get(namedPeerGroupName);
      if (namedPeerGroup != null) {<commit_msg>activate ipv4 cisco peers by default according to spec<commit_after>package batfish.representation.cisco;

import java.io.Serializable;
import java.util.EnumMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;

import batfish.main.BatfishException;
import batfish.representation.Ip;
import batfish.representation.RoutingProtocol;

public class BgpProcess implements Serializable {

   private static final int DEFAULT_BGP_DEFAULT_METRIC = 0;
   private static final long serialVersionUID = 1L;

   private Map<BgpNetwork, Boolean> _aggregateNetworks;
   private Map<String, BgpPeerGroup> _allPeerGroups;
   private boolean _alwaysCompareMed;
   private Ip _clusterId;
   private Map<String, DynamicBgpPeerGroup> _dynamicPeerGroups;
   private Map<Ip, IpBgpPeerGroup> _ipPeerGroups;
   private MasterBgpPeerGroup _masterBgpPeerGroup;
   private Map<String, NamedBgpPeerGroup> _namedPeerGroups;
   private Set<BgpNetwork> _networks;
   private int _pid;
   private Map<RoutingProtocol, BgpRedistributionPolicy> _redistributionPolicies;
   private Ip _routerId;
   private boolean _defaultIpv4Activate;

   public BgpProcess(int procnum) {
      _pid = procnum;
      _allPeerGroups = new HashMap<String, BgpPeerGroup>();
      _defaultIpv4Activate = true;
      _dynamicPeerGroups = new HashMap<String, DynamicBgpPeerGroup>();
      _namedPeerGroups = new HashMap<String, NamedBgpPeerGroup>();
      _ipPeerGroups = new HashMap<Ip, IpBgpPeerGroup>();
      _networks = new LinkedHashSet<BgpNetwork>();
      _aggregateNetworks = new HashMap<BgpNetwork, Boolean>();
      _redistributionPolicies = new EnumMap<RoutingProtocol, BgpRedistributionPolicy>(
            RoutingProtocol.class);
      _masterBgpPeerGroup = new MasterBgpPeerGroup();
      _masterBgpPeerGroup.setDefaultMetric(DEFAULT_BGP_DEFAULT_METRIC);
   }

   public DynamicBgpPeerGroup addDynamicPeerGroup(Ip ip, int prefixLength,
         String name) {
      DynamicBgpPeerGroup pg = new DynamicBgpPeerGroup(ip, prefixLength, name);
      _dynamicPeerGroups.put(name, pg);
      _allPeerGroups.put(name, pg);
      return pg;
   }

   public void addIpPeerGroup(Ip ip) {
      IpBgpPeerGroup pg = new IpBgpPeerGroup(ip);
      if (_defaultIpv4Activate) {
         pg.setActive(true);
      }
      _ipPeerGroups.put(ip, pg);
      _allPeerGroups.put(ip.toString(), pg);
   }

   public void addNamedPeerGroup(String name) {
      NamedBgpPeerGroup pg = new NamedBgpPeerGroup(name);
      _namedPeerGroups.put(name, pg);
      _allPeerGroups.put(name, pg);
   }

   public void addPeerGroupMember(Ip address, String namedPeerGroupName) {
      NamedBgpPeerGroup namedPeerGroup = _namedPeerGroups
            .get(namedPeerGroupName);
      if (namedPeerGroup != null) {
{'fraction_non_alphanumeric': 0.07968053491827637, 'fraction_numerical': 0.0014858841010401188, 'mean_word_length': 4.401203610832497, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '4555275', 'n_tokens_mistral': 1652, 'n_tokens_neox': 1625, 'n_words': 362}