Skip to content

Commit

Permalink
Merge "Routing policy schema update"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 3, 2016
2 parents b9f5735 + 553e781 commit 60ea648
Show file tree
Hide file tree
Showing 52 changed files with 373 additions and 373 deletions.
34 changes: 17 additions & 17 deletions src/bgp/bgp_config_ifmap.cc
Expand Up @@ -1567,45 +1567,45 @@ void BgpIfmapRoutingPolicyConfig::RemoveInstance(BgpIfmapInstanceConfig *rti) {
}


static void BuildPolicyTerm(autogen::PolicyTerm cfg_term,
static void BuildPolicyTerm(autogen::PolicyTermType cfg_term,
RoutingPolicyTerm *term) {
term->match.protocols_match = cfg_term.fromxx.protocol;
term->match.community_match = cfg_term.fromxx.community;
BOOST_FOREACH(const autogen::PrefixMatch &prefix_match,
cfg_term.fromxx.prefix) {
term->match.protocols_match = cfg_term.term_match_condition.protocol;
term->match.community_match = cfg_term.term_match_condition.community;
BOOST_FOREACH(const autogen::PrefixMatchType &prefix_match,
cfg_term.term_match_condition.prefix) {
PrefixMatchConfig match;
match.prefix_to_match = prefix_match.prefix;
match.prefix_match_type =
prefix_match.type_.empty() ? "exact" : prefix_match.type_;
match.prefix_match_type = prefix_match.prefix_type.empty() ?
"exact" : prefix_match.prefix_type;
term->match.prefixes_to_match.push_back(match);
}

BOOST_FOREACH(const std::string community,
cfg_term.then.update.community.add.community) {
cfg_term.term_action_list.update.community.add.community) {
term->action.update.community_add.push_back(community);
}
BOOST_FOREACH(const std::string community,
cfg_term.then.update.community.remove.community) {
cfg_term.term_action_list.update.community.remove.community) {
term->action.update.community_remove.push_back(community);
}
BOOST_FOREACH(const std::string community,
cfg_term.then.update.community.set.community) {
cfg_term.term_action_list.update.community.set.community) {
term->action.update.community_set.push_back(community);
}
term->action.update.local_pref = cfg_term.then.update.local_pref;
term->action.update.med = cfg_term.then.update.med;
term->action.update.local_pref =
cfg_term.term_action_list.update.local_pref;
term->action.update.med = cfg_term.term_action_list.update.med;
term->action.action = RoutingPolicyActionConfig::NEXT_TERM;
if (strcmp(cfg_term.then.action.c_str(), "reject") == 0) {
if (strcmp(cfg_term.term_action_list.action.c_str(), "reject") == 0)
term->action.action = RoutingPolicyActionConfig::REJECT;
} else if (strcmp(cfg_term.then.action.c_str(), "accept") == 0) {
else if (strcmp(cfg_term.term_action_list.action.c_str(), "accept") == 0)
term->action.action = RoutingPolicyActionConfig::ACCEPT;
}
}

static void BuildPolicyTerms(BgpRoutingPolicyConfig *policy_cfg,
const autogen::RoutingPolicy *policy) {
std::vector<autogen::PolicyTerm> terms = policy->entries();
BOOST_FOREACH(autogen::PolicyTerm cfg_term, terms) {
std::vector<autogen::PolicyTermType> terms = policy->entries();
BOOST_FOREACH(autogen::PolicyTermType cfg_term, terms) {
RoutingPolicyTerm policy_term;
BuildPolicyTerm(cfg_term, &policy_term);
policy_cfg->add_term(policy_term);
Expand Down
4 changes: 2 additions & 2 deletions src/bgp/bgp_config_parser.cc
Expand Up @@ -600,8 +600,8 @@ bool BgpConfigParser::ParseRoutingPolicy(const xml_node &node,
string policy_name(node.attribute("name").value());
assert(!policy_name.empty());

auto_ptr<autogen::PolicyStatement> policy_statement(
new autogen::PolicyStatement());
auto_ptr<autogen::PolicyStatementType> policy_statement(
new autogen::PolicyStatementType());
assert(policy_statement->XmlParse(node));

if (add_change) {
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/config_listener_test_10.xml
Expand Up @@ -2,15 +2,15 @@
<config>
<routing-policy name='basic_0'>
<term>
<from>
<term-match-condition>
<community>23:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test_0">
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/config_listener_test_11.xml
Expand Up @@ -3,12 +3,12 @@
<config>
<routing-policy name='basic_0'>
<term>
<from>
<term-match-condition>
<community>23:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test">
Expand Down
16 changes: 8 additions & 8 deletions src/bgp/testdata/config_listener_test_14.xml
Expand Up @@ -2,22 +2,22 @@
<config>
<routing-policy name='basic_0'>
<term>
<from>
<term-match-condition>
<community>23:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-policy name='basic_1'>
<term>
<from>
<term-match-condition>
<community>11:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test_0">
Expand Down
20 changes: 10 additions & 10 deletions src/bgp/testdata/config_listener_test_9.xml
Expand Up @@ -2,33 +2,33 @@
<config>
<routing-policy name='basic_0'>
<term>
<from>
<term-match-condition>
<community>23:13</community>
<prefix>
<prefix> 1/8 </prefix>
<type> orlonger </type>
<prefix-type> orlonger </prefix-type>
</prefix>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-policy name='basic_1'>
<term>
<from>
<term-match-condition>
<community>23:11</community>
<prefix>
<prefix> 2001:db8:85a3:aaaa::b:c:d/64 </prefix>
<type> longer </type>
<prefix-type> longer </prefix-type>
</prefix>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>reject</action>
</then>
</term-action-list>
</term>
</routing-policy>

Expand Down
18 changes: 9 additions & 9 deletions src/bgp/testdata/routing_policy_0.xml
Expand Up @@ -2,26 +2,26 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<prefix>
<prefix>10.0.1.1/32</prefix>
<type> exact </type>
<prefix-type> exact </prefix-type>
</prefix>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
<term>
<from>
<term-match-condition>
<community>11:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>reject</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test">
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/routing_policy_0a.xml
Expand Up @@ -2,12 +2,12 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<community>11:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
</config>
16 changes: 8 additions & 8 deletions src/bgp/testdata/routing_policy_0b.xml
Expand Up @@ -2,20 +2,20 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<community>11:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>accept</action>
</then>
</term-action-list>
</term>
<term>
<from>
<term-match-condition>
<community>22:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<action>reject</action>
</then>
</term-action-list>
</term>
</routing-policy>
</config>
10 changes: 5 additions & 5 deletions src/bgp/testdata/routing_policy_0c.xml
Expand Up @@ -2,21 +2,21 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<prefix>
<prefix>2001:db8:85a3::8a2e:370:7335/128</prefix>
<type>exact</type>
<prefix-type>exact</prefix-type>
</prefix>
<community>11:13</community>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<community>
<add><community>11:22</community></add>
</community>
<local-pref>300</local-pref>
</update>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test">
Expand Down
10 changes: 5 additions & 5 deletions src/bgp/testdata/routing_policy_0d.xml
Expand Up @@ -2,21 +2,21 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<prefix>
<prefix>10.0.1.1/32</prefix>
</prefix>
<prefix>
<prefix>20.1.1.0/24</prefix>
<type>longer</type>
<prefix-type>longer</prefix-type>
</prefix>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test">
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/routing_policy_0e.xml
Expand Up @@ -2,16 +2,16 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<protocol>bgp</protocol>
<protocol>xmpp</protocol>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="test">
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/routing_policy_0f.xml
Expand Up @@ -8,15 +8,15 @@
</virtual-network>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<protocol>service-chain</protocol>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>102</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
<routing-instance name="red">
Expand Down
8 changes: 4 additions & 4 deletions src/bgp/testdata/routing_policy_0g.xml
Expand Up @@ -2,17 +2,17 @@
<config>
<routing-policy name='basic'>
<term>
<from>
<term-match-condition>
<protocol>service-chain</protocol>
<protocol>bgp</protocol>
<protocol>xmpp</protocol>
</from>
<then>
</term-match-condition>
<term-action-list>
<update>
<local-pref>999</local-pref>
</update>
<action>accept</action>
</then>
</term-action-list>
</term>
</routing-policy>
</config>

0 comments on commit 60ea648

Please sign in to comment.