Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change vector to array since tbb::mutex is non-copy class #2

Open
wants to merge 19 commits into
base: R3.0.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/config/api-server/tests/test_perms2.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ def setUp(self):
auth_url='http://127.0.0.1:5000/v2.0')

# prepare token before vnc api invokes keystone
alice = User(ip, port, kc, 'alice', 'alice123', 'alice-role', 'alice-proj')
bob = User(ip, port, kc, 'bob', 'bob123', 'bob-role', 'bob-proj')
admin = User(ip, port, kc, 'admin', 'contrail123', 'admin', 'admin')
alice = User(ip, port, kc, 'alice', 'alice123', 'alice-role', 'alice-proj-%s' % self.id())
bob = User(ip, port, kc, 'bob', 'bob123', 'bob-role', 'bob-proj-%s' % self.id())
admin = User(ip, port, kc, 'admin', 'contrail123', 'admin', 'admin-%s' % self.id())

self.alice = alice
self.bob = bob
Expand Down Expand Up @@ -732,10 +732,6 @@ def test_check_obj_perms_api(self):


def tearDown(self):
self._api_svr_greenlet.kill()
self._api_server._db_conn._msgbus.shutdown()
test_utils.FakeIfmapClient.reset()
test_utils.CassandraCFs.reset()
super(TestPermissions, self).tearDown()
# end tearDown

12 changes: 9 additions & 3 deletions src/config/api-server/vnc_cfg_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2536,9 +2536,15 @@ def _db_init_entries(self):
self._create_singleton_entry(
RoutingInstance('__link_local__', link_local_vn,
routing_instance_is_default=True))
self._create_singleton_entry(
RoutingInstance('default-virtual-network',
routing_instance_is_default=True))
try:
self._create_singleton_entry(
RoutingInstance('default-virtual-network',
routing_instance_is_default=True))
except Exception as e:
self.config_log('error while creating primary routing instance for'
'default-virtual-network: ' + str(e),
level=SandeshLevel.SYS_NOTICE)

self._create_singleton_entry(DiscoveryServiceAssignment())

self._db_conn.db_resync()
Expand Down
3 changes: 2 additions & 1 deletion src/config/svc-monitor/svc_monitor/port_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def set_port_allowed_address_pairs(self, port, vmi, vmi_obj):
update_aap = True
else:
for idx in range(0, len(vmi.aaps)):
if vmi.aaps[idx]['ip'] != aaps[idx]['ip']:
if vmi.aaps[idx]['ip'] != aaps[idx]['ip'] or \
vmi.aaps[idx]['mac'] != aaps[idx]['mac']:
update_aap = True
break
if update_aap:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def set_defaults():
def set_v1_frontend_backend(pool):
conf = []
vip = VirtualIpSM.get(pool.virtual_ip)
if not vip and not vip.params['admin_state']:
return
if not vip or not vip.params['admin_state']:
return "\n"

ssl = ''
if vip.params['protocol'] == PROTO_HTTPS:
Expand Down
2 changes: 1 addition & 1 deletion src/config/svc-monitor/svc_monitor/snat_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def audit_snat_instances(self):
for si in ServiceInstanceSM.values():
si_name = si.fq_name[-1]
st_obj = ServiceTemplateSM.get(si.service_template)
if st_obj.params['service_type'] != "source-nat":
if st_obj == None or st_obj.params['service_type'] != "source-nat":
continue
lr_uuid = si.logical_router
lr = LogicalRouterSM.get(lr_uuid)
Expand Down
4 changes: 2 additions & 2 deletions src/vnsw/agent/kstate/test/test_kstate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ TEST_F(KStateTest, RouteDumpTest) {
//Addition of 2 vm ports in a new VN (VRF) will result in the following routes
// 2 routes corresponding to the addresses of VM
// l2 broadcast
// 2 - v6 host route for new vrf addition
TestRouteKState::Init(true, prev_rt_count + (MAX_TEST_FD * 2) + 3);
// 3 - v6 host route for new vrf addition
TestRouteKState::Init(true, prev_rt_count + (MAX_TEST_FD * 2) + 4);
client->WaitForIdle();
client->KStateResponseWait(1);
DeletePorts();
Expand Down
8 changes: 6 additions & 2 deletions src/vnsw/agent/services/icmpv6_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool Icmpv6Handler::Run() {
ICMPV6_TRACE(Trace, "Received ICMP with l3 disabled");
return true;
}
nd_neighbor_advert *icmp = (nd_neighbor_advert *)icmp_;
switch (icmp_->icmp6_type) {
case ND_ROUTER_SOLICIT:
icmpv6_proto->IncrementStatsRouterSolicit(vm_itf);
Expand Down Expand Up @@ -103,9 +104,12 @@ bool Icmpv6Handler::Run() {
break;

case ND_NEIGHBOR_ADVERT:
icmpv6_proto->IncrementStatsNeighborAdvert(vm_itf);
if (icmp->nd_na_flags_reserved & ND_NA_FLAG_SOLICITED) {
icmpv6_proto->IncrementStatsNeighborAdvertSolicited(vm_itf);
} else {
icmpv6_proto->IncrementStatsNeighborAdvertUnSolicited(vm_itf);
}
if (CheckPacket()) {
nd_neighbor_advert *icmp = (nd_neighbor_advert *)icmp_;
boost::array<uint8_t, 16> bytes;
for (int i = 0; i < 16; i++) {
bytes[i] = icmp->nd_na_target.s6_addr[i];
Expand Down
22 changes: 19 additions & 3 deletions src/vnsw/agent/services/icmpv6_proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ void Icmpv6Proto::VnNotify(DBEntryBase *entry) {

boost::system::error_code ec;
Ip6Address addr = Ip6Address::from_string(IPV6_ALL_ROUTERS_ADDRESS, ec);
static_cast<InetUnicastAgentRouteTable *>
(vrf->GetInet6UnicastRouteTable())->AddHostRoute(vrf->GetName(),
addr, 128,
vn->GetName());
addr = Ip6Address::from_string(IPV6_ALL_NODES_ADDRESS, ec);
static_cast<InetUnicastAgentRouteTable *>
(vrf->GetInet6UnicastRouteTable())->AddHostRoute(vrf->GetName(),
addr, 128,
Expand Down Expand Up @@ -115,6 +120,9 @@ void Icmpv6Proto::VrfNotify(DBTablePartBase *part, DBEntryBase *entry) {
Ip6Address addr =
Ip6Address::from_string(IPV6_ALL_ROUTERS_ADDRESS, ec);
// enqueue delete request on fabric VRF
agent_->fabric_inet4_unicast_table()->DeleteReq(
agent_->local_peer(), vrf->GetName(), addr, 128, NULL);
addr = Ip6Address::from_string(IPV6_ALL_NODES_ADDRESS, ec);
agent_->fabric_inet4_unicast_table()->DeleteReq(
agent_->local_peer(), vrf->GetName(), addr, 128, NULL);
addr = Ip6Address::from_string(PKT0_LINKLOCAL_ADDRESS, ec);
Expand Down Expand Up @@ -386,10 +394,18 @@ void Icmpv6Proto::IncrementStatsNeighborSolicit(VmInterface *vmi) {
}
}

void Icmpv6Proto::IncrementStatsNeighborAdvert(VmInterface *vmi) {
stats_.icmpv6_neighbor_advert_++;
void Icmpv6Proto::IncrementStatsNeighborAdvertSolicited(VmInterface *vmi) {
stats_.icmpv6_neighbor_advert_solicited_++;
Icmpv6Stats *stats = VmiToIcmpv6Stats(vmi);
if (stats) {
stats->icmpv6_neighbor_advert_solicited_++;
}
}

void Icmpv6Proto::IncrementStatsNeighborAdvertUnSolicited(VmInterface *vmi) {
stats_.icmpv6_neighbor_advert_unsolicited_++;
Icmpv6Stats *stats = VmiToIcmpv6Stats(vmi);
if (stats) {
stats->icmpv6_neighbor_advert_++;
stats->icmpv6_neighbor_advert_unsolicited_++;
}
}
9 changes: 6 additions & 3 deletions src/vnsw/agent/services/icmpv6_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Icmpv6Proto : public Proto {
void Reset() {
icmpv6_router_solicit_ = icmpv6_router_advert_ = 0;
icmpv6_ping_request_ = icmpv6_ping_response_ = icmpv6_drop_ = 0;
icmpv6_neighbor_solicit_ = icmpv6_neighbor_advert_ = 0;
icmpv6_neighbor_solicit_ = icmpv6_neighbor_advert_solicited_ = 0;
icmpv6_neighbor_advert_unsolicited_ = 0;
}

uint32_t icmpv6_router_solicit_;
Expand All @@ -40,7 +41,8 @@ class Icmpv6Proto : public Proto {
uint32_t icmpv6_ping_response_;
uint32_t icmpv6_drop_;
uint32_t icmpv6_neighbor_solicit_;
uint32_t icmpv6_neighbor_advert_;
uint32_t icmpv6_neighbor_advert_solicited_;
uint32_t icmpv6_neighbor_advert_unsolicited_;
};

typedef std::map<VmInterface *, Icmpv6Stats> VmInterfaceMap;
Expand All @@ -62,8 +64,9 @@ class Icmpv6Proto : public Proto {
void IncrementStatsPingRequest(VmInterface *vmi);
void IncrementStatsPingResponse(VmInterface *vmi);
void IncrementStatsDrop() { stats_.icmpv6_drop_++; }
void IncrementStatsNeighborAdvertSolicited(VmInterface *vmi);
void IncrementStatsNeighborAdvertUnSolicited(VmInterface *vmi);
void IncrementStatsNeighborSolicit(VmInterface *vmi);
void IncrementStatsNeighborAdvert(VmInterface *vmi);
const Icmpv6Stats &GetStats() const { return stats_; }
Icmpv6Stats *VmiToIcmpv6Stats(VmInterface *i);
void ClearStats() { stats_.Reset(); }
Expand Down
6 changes: 4 additions & 2 deletions src/vnsw/agent/services/services.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ response sandesh Icmpv6Stats {
4: i32 icmpv6_ping_response;
5: i32 icmpv6_drop;
6: i32 icmpv6_neighbor_solicit;
7: i32 icmpv6_neighbor_advert;
7: i32 icmpv6_neighbor_advert_solicited;
8: i32 icmpv6_neighbor_advert_unsolicited;
}

/**
Expand Down Expand Up @@ -253,7 +254,8 @@ struct InterfaceIcmpv6Stats {
4: u32 icmpv6_ping_request;
5: u32 icmpv6_ping_response;
6: u32 icmpv6_neighbor_solicit;
7: u32 icmpv6_neighbor_advert;
7: u32 icmpv6_neighbor_advert_solicited;
8: u32 icmpv6_neighbor_advert_unsolicited;
}

/**
Expand Down
10 changes: 8 additions & 2 deletions src/vnsw/agent/services/services_sandesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
entry.set_icmpv6_ping_request(stats.icmpv6_ping_request_); \
entry.set_icmpv6_ping_response(stats.icmpv6_ping_response_); \
entry.set_icmpv6_neighbor_solicit(stats.icmpv6_neighbor_solicit_); \
entry.set_icmpv6_neighbor_advert(stats.icmpv6_neighbor_advert_); \
entry.set_icmpv6_neighbor_advert_solicited \
(stats.icmpv6_neighbor_advert_solicited_); \
entry.set_icmpv6_neighbor_advert_unsolicited \
(stats.icmpv6_neighbor_advert_unsolicited_); \
list.push_back(entry);

std::map<uint16_t, std::string> g_ip_protocol_map =
Expand Down Expand Up @@ -261,7 +264,10 @@ void ServicesSandesh::Icmpv6StatsSandesh(std::string ctxt, bool more) {
icmp->set_icmpv6_ping_response(istats.icmpv6_ping_response_);
icmp->set_icmpv6_drop(istats.icmpv6_drop_);
icmp->set_icmpv6_neighbor_solicit(istats.icmpv6_neighbor_solicit_);
icmp->set_icmpv6_neighbor_advert(istats.icmpv6_neighbor_advert_);
icmp->set_icmpv6_neighbor_advert_solicited
(istats.icmpv6_neighbor_advert_solicited_);
icmp->set_icmpv6_neighbor_advert_unsolicited
(istats.icmpv6_neighbor_advert_unsolicited_);
icmp->set_context(ctxt);
icmp->set_more(more);
icmp->Response();
Expand Down
6 changes: 3 additions & 3 deletions src/vnsw/agent/test/test_agent_route_walker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ TEST_F(AgentRouteWalkerTest, walk_all_routes_wih_1_vrf) {
client->Reset();
SetupEnvironment(1);
StartVrfWalk();
VerifyNotifications(19, 2, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 2));
VerifyNotifications(20, 2, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 2));
EXPECT_TRUE(walk_task_context_mismatch_ == false);
walk_task_context_mismatch_ = true;
DeleteEnvironment(1);
Expand All @@ -287,7 +287,7 @@ TEST_F(AgentRouteWalkerTest, walk_all_routes_with_2_vrf) {
client->Reset();
SetupEnvironment(2);
StartVrfWalk();
VerifyNotifications(29, 3, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 3));
VerifyNotifications(31, 3, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 3));
EXPECT_TRUE(walk_task_context_mismatch_ == false);
walk_task_context_mismatch_ = true;
DeleteEnvironment(2);
Expand All @@ -297,7 +297,7 @@ TEST_F(AgentRouteWalkerTest, walk_all_routes_with_3_vrf) {
client->Reset();
SetupEnvironment(3);
StartVrfWalk();
VerifyNotifications(39, 4, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 4));
VerifyNotifications(42, 4, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 4));
EXPECT_TRUE(walk_task_context_mismatch_ == false);
walk_task_context_mismatch_ = true;
DeleteEnvironment(3);
Expand Down
4 changes: 3 additions & 1 deletion src/vnsw/agent/vrouter/ksync/ksync_flow_index_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ KSyncFlowIndexManager::KSyncFlowIndexManager(KSync *ksync) :
}

KSyncFlowIndexManager::~KSyncFlowIndexManager() {
if (count_ > 0)
delete [] index_list_;
}

void KSyncFlowIndexManager::InitDone(uint32_t count) {
proto_ = ksync_->agent()->pkt()->get_flow_proto();
count_ = count;
index_list_.resize(count);
index_list_ = new struct IndexEntry[count_];
sm_log_count_ = ksync_->agent()->params()->flow_index_sm_log_count();
}

Expand Down
4 changes: 2 additions & 2 deletions src/vnsw/agent/vrouter/ksync/ksync_flow_index_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class KSyncFlowIndexManager {
tbb::mutex mutex_;
FlowEntryPtr owner_;
};
typedef std::vector<IndexEntry> IndexList;
//typedef std::vector<IndexEntry> IndexList;

KSyncFlowIndexManager(KSync *ksync);
virtual ~KSyncFlowIndexManager();
Expand Down Expand Up @@ -68,7 +68,7 @@ class KSyncFlowIndexManager {
KSync *ksync_;
FlowProto *proto_;
uint32_t count_;
IndexList index_list_;
struct IndexEntry *index_list_;
uint16_t sm_log_count_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def parse_args(self, auth_conf=None):
auth_version = tmp_auth_url.split('/')[-1]
if (auth_version.lower() == 'v2.0'):
self.auth_version = '2'
elif (auth_version.lower() == 'v3.0'):
elif (auth_version.lower() == 'v3'):
self.auth_version = '3'
self.admin_user_domain = config.get('BARBICAN', 'admin_user_domain')
self.admin_project_domain = config.get('BARBICAN', 'admin_project_domain')
Expand Down
2 changes: 1 addition & 1 deletion src/zookeeper/zookeeper_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

#include <cerrno>

#include <string.h>
#include <base/logging.h>

#include <zookeeper/zookeeper_client.h>
Expand Down