Skip to content

Commit

Permalink
Merge "Add BGP Peers to graceful_restart_test"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 23, 2016
2 parents e10e31d + 3a3fc31 commit d34c84d
Show file tree
Hide file tree
Showing 27 changed files with 1,218 additions and 352 deletions.
26 changes: 13 additions & 13 deletions src/bgp/bgp_attr.cc
Expand Up @@ -332,10 +332,10 @@ PmsiTunnel::PmsiTunnel(PmsiTunnelDB *pmsi_tunnel_db,
: pmsi_tunnel_db_(pmsi_tunnel_db),
pmsi_spec_(pmsi_spec) {
refcount_ = 0;
tunnel_flags = pmsi_spec_.tunnel_flags;
tunnel_type = pmsi_spec_.tunnel_type;
label = pmsi_spec_.label;
identifier = pmsi_spec_.GetIdentifier();
tunnel_flags_ = pmsi_spec_.tunnel_flags;
tunnel_type_ = pmsi_spec_.tunnel_type;
label_ = pmsi_spec_.label;
identifier_ = pmsi_spec_.GetIdentifier();
}

void PmsiTunnel::Remove() {
Expand Down Expand Up @@ -684,13 +684,13 @@ BgpOList::BgpOList(BgpOListDB *olist_db, const BgpOListSpec &olist_spec)
olist_spec_.elements.begin(); it != olist_spec_.elements.end(); ++it) {
BgpOListElem *elem = new BgpOListElem(*it);
sort(elem->encap.begin(), elem->encap.end());
elements.push_back(elem);
elements_.push_back(elem);
}
sort(elements.begin(), elements.end(), BgpOListElemCompare());
sort(elements_.begin(), elements_.end(), BgpOListElemCompare());
}

BgpOList::~BgpOList() {
STLDeleteValues(&elements);
STLDeleteValues(&elements_);
}

struct BgpOListElementCompare {
Expand All @@ -702,8 +702,8 @@ struct BgpOListElementCompare {

int BgpOList::CompareTo(const BgpOList &rhs) const {
KEY_COMPARE(olist().subcode, rhs.olist().subcode);
int result = STLSortedCompare(elements.begin(), elements.end(),
rhs.elements.begin(), rhs.elements.end(),
int result = STLSortedCompare(elements().begin(), elements().end(),
rhs.elements().begin(), rhs.elements().end(),
BgpOListElementCompare());
return result;
}
Expand Down Expand Up @@ -1017,12 +1017,12 @@ std::size_t hash_value(BgpAttr const &attr) {
}

if (attr.olist_) {
boost::hash_range(hash, attr.olist_->elements.begin(),
attr.olist_->elements.end());
boost::hash_range(hash, attr.olist_->elements().begin(),
attr.olist_->elements().end());
}
if (attr.leaf_olist_) {
boost::hash_range(hash, attr.leaf_olist_->elements.begin(),
attr.leaf_olist_->elements.end());
boost::hash_range(hash, attr.leaf_olist_->elements().begin(),
attr.leaf_olist_->elements().end());
}

if (attr.as_path_) boost::hash_combine(hash, *attr.as_path_);
Expand Down
26 changes: 19 additions & 7 deletions src/bgp/bgp_attr.h
Expand Up @@ -199,6 +199,7 @@ class ClusterList {
friend int intrusive_ptr_add_ref(const ClusterList *ccluster_list);
friend int intrusive_ptr_del_ref(const ClusterList *ccluster_list);
friend void intrusive_ptr_release(const ClusterList *ccluster_list);
friend class ClusterListDB;

mutable tbb::atomic<int> refcount_;
ClusterListDB *cluster_list_db_;
Expand Down Expand Up @@ -332,7 +333,7 @@ class PmsiTunnel {

const PmsiTunnelSpec &pmsi_tunnel() const { return pmsi_spec_; }
uint32_t GetLabel(bool is_vni = false) const {
return (is_vni ? label : label >> 4);
return (is_vni ? label_ : label_ >> 4);
}

friend std::size_t hash_value(const PmsiTunnel &pmsi_tunnel) {
Expand All @@ -341,16 +342,21 @@ class PmsiTunnel {
return hash;
}

uint8_t tunnel_flags;
uint8_t tunnel_type;
Ip4Address identifier;
const uint8_t tunnel_flags() const { return tunnel_flags_; }
const uint8_t tunnel_type() const { return tunnel_type_; }
const Ip4Address identifier() const { return identifier_; }
const uint32_t label() const { return label_; }

private:
friend int intrusive_ptr_add_ref(const PmsiTunnel *cpmsi_tunnel);
friend int intrusive_ptr_del_ref(const PmsiTunnel *cpmsi_tunnel);
friend void intrusive_ptr_release(const PmsiTunnel *cpmsi_tunnel);
friend class PmsiTunnelDB;

uint32_t label;
uint8_t tunnel_flags_;
uint8_t tunnel_type_;
Ip4Address identifier_;
uint32_t label_;
mutable tbb::atomic<int> refcount_;
PmsiTunnelDB *pmsi_tunnel_db_;
PmsiTunnelSpec pmsi_spec_;
Expand Down Expand Up @@ -453,6 +459,7 @@ class EdgeDiscovery {
friend int intrusive_ptr_add_ref(const EdgeDiscovery *ediscovery);
friend int intrusive_ptr_del_ref(const EdgeDiscovery *ediscovery);
friend void intrusive_ptr_release(const EdgeDiscovery *ediscovery);
friend class EdgeDiscoveryDB;

mutable tbb::atomic<int> refcount_;
EdgeDiscoveryDB *edge_discovery_db_;
Expand Down Expand Up @@ -559,6 +566,7 @@ class EdgeForwarding {
friend int intrusive_ptr_add_ref(const EdgeForwarding *ceforwarding);
friend int intrusive_ptr_del_ref(const EdgeForwarding *ceforwarding);
friend void intrusive_ptr_release(const EdgeForwarding *ceforwarding);
friend class EdgeForwardingDB;

mutable tbb::atomic<int> refcount_;
EdgeForwardingDB *edge_forwarding_db_;
Expand Down Expand Up @@ -665,13 +673,16 @@ class BgpOList {
}

typedef std::vector<BgpOListElem *> Elements;
Elements elements;

const Elements &elements() const { return elements_; }

private:
friend int intrusive_ptr_add_ref(const BgpOList *colist);
friend int intrusive_ptr_del_ref(const BgpOList *colist);
friend void intrusive_ptr_release(const BgpOList *colist);
friend class BgpOListDB;

Elements elements_;
mutable tbb::atomic<int> refcount_;
BgpOListDB *olist_db_;
BgpOListSpec olist_spec_;
Expand Down Expand Up @@ -769,8 +780,8 @@ class BgpAttr {
explicit BgpAttr(const BgpAttr &rhs);
BgpAttr(BgpAttrDB *attr_db, const BgpAttrSpec &spec);
virtual ~BgpAttr() { }

virtual void Remove();

int CompareTo(const BgpAttr &rhs) const;

void set_origin(BgpAttrOrigin::OriginType org) { origin_ = org; }
Expand Down Expand Up @@ -844,6 +855,7 @@ class BgpAttr {

private:
friend class BgpAttrDB;
friend class BgpAttrTest;
friend int intrusive_ptr_add_ref(const BgpAttr *cattrp);
friend int intrusive_ptr_del_ref(const BgpAttr *cattrp);
friend void intrusive_ptr_release(const BgpAttr *cattrp);
Expand Down
2 changes: 1 addition & 1 deletion src/bgp/bgp_attr_base.h
Expand Up @@ -223,7 +223,7 @@ class BgpPathAttributeDB {
}

// Decrement the counter bumped up above as we can't use this entry
// which is above to be deleted. Instead, retry inserting the passed
// which is about to be deleted. Instead, retry inserting the passed
// entry again, into the database.
intrusive_ptr_del_ref(*ret.first);
}
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/bgp_evpn.cc
Expand Up @@ -85,10 +85,10 @@ bool EvpnMcastNode::UpdateAttributes(EvpnRoute *route) {

const PmsiTunnel *pmsi_tunnel = attr_->pmsi_tunnel();
uint8_t ar_type =
pmsi_tunnel->tunnel_flags & PmsiTunnelSpec::AssistedReplicationType;
pmsi_tunnel->tunnel_flags() & PmsiTunnelSpec::AssistedReplicationType;

bool edge_replication_not_supported = false;
if ((pmsi_tunnel->tunnel_flags &
if ((pmsi_tunnel->tunnel_flags() &
PmsiTunnelSpec::EdgeReplicationSupported) == 0) {
edge_replication_not_supported = true;
}
Expand Down Expand Up @@ -117,8 +117,8 @@ bool EvpnMcastNode::UpdateAttributes(EvpnRoute *route) {
address_ = path->GetAttr()->nexthop().to_v4();
changed = true;
}
if (replicator_address_ != pmsi_tunnel->identifier) {
replicator_address_ = pmsi_tunnel->identifier;
if (replicator_address_ != pmsi_tunnel->identifier()) {
replicator_address_ = pmsi_tunnel->identifier();
changed = true;
}

Expand Down
7 changes: 5 additions & 2 deletions src/bgp/bgp_origin_vn_path.h
Expand Up @@ -50,9 +50,8 @@ class OriginVnPath {
explicit OriginVnPath(OriginVnPathDB *ovnpath_db,
const OriginVnPathSpec spec);
virtual ~OriginVnPath() { }

virtual void Remove();
void Prepend(const OriginVnValue &value);

bool Contains(const OriginVnValue &value) const;
int CompareTo(const OriginVnPath &rhs) const;

Expand All @@ -71,6 +70,10 @@ class OriginVnPath {
friend int intrusive_ptr_add_ref(const OriginVnPath *covnpath);
friend int intrusive_ptr_del_ref(const OriginVnPath *covnpath);
friend void intrusive_ptr_release(const OriginVnPath *covnpath);
friend class OriginVnPathDB;
friend class BgpAttrTest;

void Prepend(const OriginVnValue &value);

mutable tbb::atomic<int> refcount_;
OriginVnPathDB *ovnpath_db_;
Expand Down

0 comments on commit d34c84d

Please sign in to comment.