1 00:00:00,000 --> 00:00:00,944 2 00:00:00,944 --> 00:00:04,248 [AUDIO LOGO] 3 00:00:04,248 --> 00:00:08,029 4 00:00:08,029 --> 00:00:13,280 Now that we've looked at route maps on IOS XE, let's jump in 5 00:00:13,280 --> 00:00:16,219 and look at the similar feature that we 6 00:00:16,219 --> 00:00:22,640 have on IOS XR, which is routing policy language, or RPO. 7 00:00:22,640 --> 00:00:27,020 Now it's similar in that we use it to handle those advanced 8 00:00:27,020 --> 00:00:31,280 route filtering and manipulation issues that we need 9 00:00:31,280 --> 00:00:33,750 to accomplish on our devices. 10 00:00:33,750 --> 00:00:37,460 It's a little bit different in that, well, it's more advanced. 11 00:00:37,460 --> 00:00:41,510 It addresses some of the issues that we have with route maps. 12 00:00:41,510 --> 00:00:46,430 Now this is very much a scripted-type language. 13 00:00:46,430 --> 00:00:50,780 We're going to be using if, then, else, endif, things 14 00:00:50,780 --> 00:00:54,500 like this, and use that to both filter 15 00:00:54,500 --> 00:00:56,790 and manipulate our routes. 16 00:00:56,790 --> 00:00:59,180 So, in this video, what we're going to do 17 00:00:59,180 --> 00:01:03,620 is jump in and take a look at the formatting of RPO 18 00:01:03,620 --> 00:01:05,840 and some of the different options we have 19 00:01:05,840 --> 00:01:09,600 and how it gets processed on the devices. 20 00:01:09,600 --> 00:01:12,680 So let's go ahead and jump in and take a look 21 00:01:12,680 --> 00:01:15,710 at those details. 22 00:01:15,710 --> 00:01:21,850 So, again, RPO is the upgraded or more advanced version 23 00:01:21,850 --> 00:01:23,560 of route maps. 24 00:01:23,560 --> 00:01:25,480 And this is, of course, what we have 25 00:01:25,480 --> 00:01:29,050 that's available on IOS XR. 26 00:01:29,050 --> 00:01:34,600 What shortcomings of route maps was routing policy language 27 00:01:34,600 --> 00:01:36,520 designed to fix? 28 00:01:36,520 --> 00:01:41,080 Well, first, it has better modularity. 29 00:01:41,080 --> 00:01:44,290 We can re-use pieces in different scripts. 30 00:01:44,290 --> 00:01:48,340 So that also goes with the better reusability. 31 00:01:48,340 --> 00:01:52,030 It also has parameterization, which 32 00:01:52,030 --> 00:01:54,910 we'll take a look at this in the next video 33 00:01:54,910 --> 00:01:57,590 when we get into more advanced features. 34 00:01:57,590 --> 00:02:01,930 However, this is sort of like using variables in a script. 35 00:02:01,930 --> 00:02:06,460 We can use this to pass values between RPO scripts and things 36 00:02:06,460 --> 00:02:07,630 like this. 37 00:02:07,630 --> 00:02:14,020 We can also do nesting, both for policies and conditions. 38 00:02:14,020 --> 00:02:16,570 We have very powerful match options-- 39 00:02:16,570 --> 00:02:18,590 again, we'll be looking at those as well-- 40 00:02:18,590 --> 00:02:21,820 and reusable value sets. 41 00:02:21,820 --> 00:02:25,750 Now the reusable value sets, to a certain extent, 42 00:02:25,750 --> 00:02:28,420 are a little bit like the access lists 43 00:02:28,420 --> 00:02:32,290 and the prefix lists that we use with route maps. 44 00:02:32,290 --> 00:02:35,980 And we could reuse those in different route maps too, 45 00:02:35,980 --> 00:02:40,510 but these are value sets that are very easy to work with. 46 00:02:40,510 --> 00:02:44,290 Another difference between route maps and RPO-- 47 00:02:44,290 --> 00:02:49,430 RPO is not made up of statements like route maps are, 48 00:02:49,430 --> 00:02:52,070 but instead, it's a policy. 49 00:02:52,070 --> 00:02:54,860 Again, this is much more like a script. 50 00:02:54,860 --> 00:02:59,260 This is defined between the opening words, where 51 00:02:59,260 --> 00:03:01,600 we start defining our route policy, 52 00:03:01,600 --> 00:03:07,150 and the end policy command, which is where the policy ends. 53 00:03:07,150 --> 00:03:09,310 So as we're writing it, everything 54 00:03:09,310 --> 00:03:11,590 will start with route-policy, and then 55 00:03:11,590 --> 00:03:13,300 once we've written the whole policy, 56 00:03:13,300 --> 00:03:18,670 end-policy is how we exit and save that policy. 57 00:03:18,670 --> 00:03:22,480 Now, of course, where they're similar to route maps is 58 00:03:22,480 --> 00:03:25,810 they can filter and manipulate routes. 59 00:03:25,810 --> 00:03:28,450 That's really the whole purpose of this. 60 00:03:28,450 --> 00:03:31,330 To do this, we do have some keywords. 61 00:03:31,330 --> 00:03:35,530 First, we have pass and drop. 62 00:03:35,530 --> 00:03:39,190 These are the commands that are going to be used for filtering. 63 00:03:39,190 --> 00:03:43,930 Anything, of course, that is set to pass will be permitted. 64 00:03:43,930 --> 00:03:46,960 Anything set to drop will be dropped. 65 00:03:46,960 --> 00:03:51,130 And then, for manipulation or modification of the route, 66 00:03:51,130 --> 00:03:55,120 we'll use set or delete. 67 00:03:55,120 --> 00:03:58,030 Now don't confuse delete with drop. 68 00:03:58,030 --> 00:04:01,420 Drop, of course, means we're dropping the route itself. 69 00:04:01,420 --> 00:04:05,500 Delete means we would be, say, deleting an attribute. 70 00:04:05,500 --> 00:04:09,280 Maybe it's a BGP route that has a certain community 71 00:04:09,280 --> 00:04:10,180 string on it. 72 00:04:10,180 --> 00:04:12,700 And we want to remove that community string. 73 00:04:12,700 --> 00:04:15,040 Or maybe we want to remove a route tag 74 00:04:15,040 --> 00:04:16,570 from a particular route. 75 00:04:16,570 --> 00:04:18,800 This is where the delete comes in. 76 00:04:18,800 --> 00:04:21,519 So, again, delete is not about whether we're permitting 77 00:04:21,519 --> 00:04:22,810 or denying the route. 78 00:04:22,810 --> 00:04:25,760 It's about removing attributes. 79 00:04:25,760 --> 00:04:30,610 So next up here, we have quite a few rules about RPO 80 00:04:30,610 --> 00:04:32,330 that we want to be aware of. 81 00:04:32,330 --> 00:04:34,270 So let's make sure we go through each of these 82 00:04:34,270 --> 00:04:36,290 and understand what they are. 83 00:04:36,290 --> 00:04:42,980 First is the default action, if we don't specify, is to drop. 84 00:04:42,980 --> 00:04:45,850 This means, of course, that an empty policy where 85 00:04:45,850 --> 00:04:49,450 we haven't specified anything will implicitly 86 00:04:49,450 --> 00:04:51,950 deny all routes. 87 00:04:51,950 --> 00:04:53,890 So that's our first rule. 88 00:04:53,890 --> 00:05:00,130 Second, if you do an explicit pass without any conditions, 89 00:05:00,130 --> 00:05:03,340 that will then forward all routes. 90 00:05:03,340 --> 00:05:05,710 Now it won't change anything about those routes. 91 00:05:05,710 --> 00:05:07,580 It will just forward them through. 92 00:05:07,580 --> 00:05:10,790 So, again, there would be no modifications to those. 93 00:05:10,790 --> 00:05:12,940 But they will simply be sent. 94 00:05:12,940 --> 00:05:14,710 Now rule number three here-- 95 00:05:14,710 --> 00:05:17,320 an explicit drop will do the same 96 00:05:17,320 --> 00:05:20,200 as an implicit drop, which means it's literally just doing 97 00:05:20,200 --> 00:05:21,790 the same thing here. 98 00:05:21,790 --> 00:05:25,600 One advantage here is you can get some logging on this. 99 00:05:25,600 --> 00:05:28,360 For our fourth rule, our statement 100 00:05:28,360 --> 00:05:33,850 is that a set command will, of course, modify the attributes-- 101 00:05:33,850 --> 00:05:35,890 whatever it's set to change-- 102 00:05:35,890 --> 00:05:39,580 and it will forward all the routes. 103 00:05:39,580 --> 00:05:43,790 There's an implicit pass when you use a set command. 104 00:05:43,790 --> 00:05:47,110 So you don't have to specifically put in pass. 105 00:05:47,110 --> 00:05:50,710 Truth be told, I usually still put pass in there, 106 00:05:50,710 --> 00:05:53,350 even when I do a set, because I find 107 00:05:53,350 --> 00:05:55,450 it's a little bit easier to read through later. 108 00:05:55,450 --> 00:05:57,350 That's just personal preference. 109 00:05:57,350 --> 00:05:59,620 You can certainly put your own pass, 110 00:05:59,620 --> 00:06:03,580 but you don't have to as long as there's a set command. 111 00:06:03,580 --> 00:06:08,330 And the last thing here is if there's an explicit drop-- 112 00:06:08,330 --> 00:06:11,440 so again, this is pretty much what we did in statement three 113 00:06:11,440 --> 00:06:12,280 up here-- 114 00:06:12,280 --> 00:06:16,290 but it will stop the processing of the policy, 115 00:06:16,290 --> 00:06:20,970 denies the route, even if there are other statements. 116 00:06:20,970 --> 00:06:22,800 Essentially, what this last statement 117 00:06:22,800 --> 00:06:27,450 is saying is if the action is to drop, 118 00:06:27,450 --> 00:06:30,690 it's going to ignore any set commands. 119 00:06:30,690 --> 00:06:33,600 You don't want to modify something if you're just 120 00:06:33,600 --> 00:06:35,280 going to discard it. 121 00:06:35,280 --> 00:06:38,560 The analogy I always use here is if you're going to scrap 122 00:06:38,560 --> 00:06:40,560 your car-- it's no good, you're going to send it 123 00:06:40,560 --> 00:06:41,970 to the junkyard-- 124 00:06:41,970 --> 00:06:44,640 you don't usually wash it, sand it down, 125 00:06:44,640 --> 00:06:47,400 and paint it so it looks nice before you send it 126 00:06:47,400 --> 00:06:48,450 to the junkyard. 127 00:06:48,450 --> 00:06:52,230 Why would we modify something-- make it better, different, 128 00:06:52,230 --> 00:06:55,320 whatever-- if we're just going to discard it anyway? 129 00:06:55,320 --> 00:06:59,250 So again, if there is a drop statement, that's it. 130 00:06:59,250 --> 00:07:01,020 It stops all processing. 131 00:07:01,020 --> 00:07:04,350 So even if you put set commands on that same statement, 132 00:07:04,350 --> 00:07:06,500 they would be ignored. 133 00:07:06,500 --> 00:07:09,310 So let's talk about some of those conditional statements 134 00:07:09,310 --> 00:07:11,420 that we can use. 135 00:07:11,420 --> 00:07:14,230 So in the spirit of this being a lot like a script, 136 00:07:14,230 --> 00:07:17,890 we have things like if, elseif-- 137 00:07:17,890 --> 00:07:20,810 so, of course, that means if the if statement is not true, 138 00:07:20,810 --> 00:07:22,960 it will then do this other thing. 139 00:07:22,960 --> 00:07:26,860 You can also just do an else, and we have endif 140 00:07:26,860 --> 00:07:29,440 to close that statement out. 141 00:07:29,440 --> 00:07:33,230 Conditions can be used in these operators as well. 142 00:07:33,230 --> 00:07:38,350 We have equals, less than or equal to, greater than 143 00:07:38,350 --> 00:07:43,060 or equal to, is, and in. 144 00:07:43,060 --> 00:07:45,070 A little bit of clarification here-- 145 00:07:45,070 --> 00:07:49,730 first off, we have equals which, you might remember, 146 00:07:49,730 --> 00:07:52,180 we don't really have on route maps 147 00:07:52,180 --> 00:07:54,710 and prefix lists and things like that. 148 00:07:54,710 --> 00:07:57,010 Remember, we had to use a combination 149 00:07:57,010 --> 00:08:00,760 of less than or equal to or greater than or equal to. 150 00:08:00,760 --> 00:08:03,070 Here, we actually have an equals. 151 00:08:03,070 --> 00:08:05,290 So you might look at that and say, well, that's cool. 152 00:08:05,290 --> 00:08:09,400 But if we haven't equals, then what is the is? 153 00:08:09,400 --> 00:08:11,020 How are those different? 154 00:08:11,020 --> 00:08:14,440 Well, equals is going to be numeric. 155 00:08:14,440 --> 00:08:17,350 This will be some sort of a numeric value. 156 00:08:17,350 --> 00:08:21,110 "Is" can be any kind of value. 157 00:08:21,110 --> 00:08:23,488 So, again, usually, we would use equal 158 00:08:23,488 --> 00:08:25,780 because most of the things we're going to be looking at 159 00:08:25,780 --> 00:08:27,590 will be numeric values. 160 00:08:27,590 --> 00:08:33,324 But if there's something else we want to look at, we can say is. 161 00:08:33,324 --> 00:08:36,400 In if we're going to use one of our sets. 162 00:08:36,400 --> 00:08:39,289 We'll be talking about these in a little bit. 163 00:08:39,289 --> 00:08:43,690 But that's the basic idea behind these different conditions. 164 00:08:43,690 --> 00:08:46,790 We can also use Boolean operators. 165 00:08:46,790 --> 00:08:53,170 So we have available and, or, and not. 166 00:08:53,170 --> 00:08:57,340 The way these work is they can be combined. 167 00:08:57,340 --> 00:09:04,480 Not is processed first, then and, and then or. 168 00:09:04,480 --> 00:09:06,590 So that's the order of operations. 169 00:09:06,590 --> 00:09:11,840 However, that can be modified with parentheses. 170 00:09:11,840 --> 00:09:13,780 So to a certain extent, it's a little bit 171 00:09:13,780 --> 00:09:16,150 like an algebraic equation. 172 00:09:16,150 --> 00:09:18,820 We can modify the order of operations 173 00:09:18,820 --> 00:09:21,220 based on the use of parentheses. 174 00:09:21,220 --> 00:09:24,920 Again, the best way to see this is maybe to look at an example. 175 00:09:24,920 --> 00:09:26,660 So let's do that. 176 00:09:26,660 --> 00:09:31,120 So, our first example here, we have no parentheses. 177 00:09:31,120 --> 00:09:34,180 We're not counting the ones around the community 178 00:09:34,180 --> 00:09:37,810 back here, where we're saying that we can match anything 179 00:09:37,810 --> 00:09:39,800 in that community string. 180 00:09:39,800 --> 00:09:42,320 So let's just look at the statement itself. 181 00:09:42,320 --> 00:09:46,600 So the first thing is that the med has to equal 100, 182 00:09:46,600 --> 00:09:49,540 and we sort of have two operators together here-- 183 00:09:49,540 --> 00:09:54,040 and not the local preference equals 200. 184 00:09:54,040 --> 00:09:56,620 So really, there's two conditions here 185 00:09:56,620 --> 00:09:59,470 where a route would pass through this. 186 00:09:59,470 --> 00:10:04,090 First, if the med was 100 and the local preference 187 00:10:04,090 --> 00:10:08,200 was, say, 250, that would match the first part of this 188 00:10:08,200 --> 00:10:10,690 that's in front of the or. 189 00:10:10,690 --> 00:10:14,020 So that means the route would meet this criteria. 190 00:10:14,020 --> 00:10:20,500 Or we could have a route where the community is 1000:1. 191 00:10:20,500 --> 00:10:22,150 So, essentially, what we're saying here 192 00:10:22,150 --> 00:10:25,690 is the split on this statement is right here at the or. 193 00:10:25,690 --> 00:10:28,968 We either have to meet the first part or the second part. 194 00:10:28,968 --> 00:10:30,760 The first part is a little more complicated 195 00:10:30,760 --> 00:10:32,750 because, again, it's compound. 196 00:10:32,750 --> 00:10:35,000 It's an and not. 197 00:10:35,000 --> 00:10:38,420 So what would not meet this is, of course, 198 00:10:38,420 --> 00:10:42,460 if it was 100 and 200. 199 00:10:42,460 --> 00:10:45,070 That would not match because it's not 200 00:10:45,070 --> 00:10:48,190 local preference equals 200. 201 00:10:48,190 --> 00:10:50,600 Now looking at the second statement, 202 00:10:50,600 --> 00:10:53,800 we now introduce a set of parentheses, 203 00:10:53,800 --> 00:10:57,730 and this is where things get interesting because now 204 00:10:57,730 --> 00:11:01,060 what we have is an and. 205 00:11:01,060 --> 00:11:04,030 So now we have to meet both of these criteria 206 00:11:04,030 --> 00:11:07,130 because the and is outside the parentheses. 207 00:11:07,130 --> 00:11:10,310 Now the first criteria in this one is fairly simple. 208 00:11:10,310 --> 00:11:12,970 The med has to equal 100. 209 00:11:12,970 --> 00:11:16,360 So a route comes in with a med of 100. 210 00:11:16,360 --> 00:11:18,010 That's fine. 211 00:11:18,010 --> 00:11:20,500 And what? 212 00:11:20,500 --> 00:11:25,540 And it's either not a local preference of 200 213 00:11:25,540 --> 00:11:30,340 or the community of 1000:1. 214 00:11:30,340 --> 00:11:32,680 So what would match this? 215 00:11:32,680 --> 00:11:37,300 Well, if the local preference was 250, again, 216 00:11:37,300 --> 00:11:39,160 that would be OK. 217 00:11:39,160 --> 00:11:41,740 Or maybe something comes in and it's 218 00:11:41,740 --> 00:11:46,780 100 with a local preference of 200, 219 00:11:46,780 --> 00:11:51,130 but the community is 1000:1. 220 00:11:51,130 --> 00:11:53,830 So it's not matching the local preference, 221 00:11:53,830 --> 00:11:56,480 but it is matching on the community. 222 00:11:56,480 --> 00:11:58,570 So that would still be OK. 223 00:11:58,570 --> 00:12:01,660 What would not match in this case is 224 00:12:01,660 --> 00:12:04,480 if it comes in with a med of 100, 225 00:12:04,480 --> 00:12:09,710 the local preference is 200, and the community string 226 00:12:09,710 --> 00:12:13,340 is 1010:10-- 227 00:12:13,340 --> 00:12:15,060 something different. 228 00:12:15,060 --> 00:12:19,460 This is no good because it doesn't meet the or criteria. 229 00:12:19,460 --> 00:12:21,320 The community string is not right, 230 00:12:21,320 --> 00:12:25,350 and the local preference is supposed to not be 200. 231 00:12:25,350 --> 00:12:26,930 So, in this case, it doesn't meet 232 00:12:26,930 --> 00:12:29,840 either side of the criteria. 233 00:12:29,840 --> 00:12:32,780 The last example is really interesting 234 00:12:32,780 --> 00:12:35,660 because all we really do is change the position 235 00:12:35,660 --> 00:12:37,410 of the parentheses. 236 00:12:37,410 --> 00:12:42,980 Now it's and not, which means the second half of this 237 00:12:42,980 --> 00:12:46,100 has to be not true. 238 00:12:46,100 --> 00:12:49,607 Now once again, we have the med has to equal 100. 239 00:12:49,607 --> 00:12:51,440 And you might have noticed, I haven't really 240 00:12:51,440 --> 00:12:53,232 been messing with the med in these examples 241 00:12:53,232 --> 00:12:55,080 because it's fairly straightforward. 242 00:12:55,080 --> 00:12:58,130 So OK, fine-- once again, the med 243 00:12:58,130 --> 00:13:03,320 has to equal 100 and not the local preference 244 00:13:03,320 --> 00:13:08,930 being 200 or the community being 1000:1. 245 00:13:08,930 --> 00:13:11,330 So what would meet this criteria? 246 00:13:11,330 --> 00:13:15,500 Well, local preference could be 250. 247 00:13:15,500 --> 00:13:17,930 That's not 200. 248 00:13:17,930 --> 00:13:23,940 Or the community could be 1010:10. 249 00:13:23,940 --> 00:13:27,570 That would be good because that's a med of 100 250 00:13:27,570 --> 00:13:30,750 and not a local preference of 200 251 00:13:30,750 --> 00:13:35,010 and not a community of 1000:1. 252 00:13:35,010 --> 00:13:40,770 What would not match this is if my med was 100 253 00:13:40,770 --> 00:13:49,710 and my local preference was 200 and my community was 1010:10. 254 00:13:49,710 --> 00:13:53,040 Where this is failing is it's not 255 00:13:53,040 --> 00:14:00,060 supposed to be 200 or 1000:1. 256 00:14:00,060 --> 00:14:02,910 Well, unfortunately, this one's a 200, 257 00:14:02,910 --> 00:14:08,810 so that fails the not 200 part, just like if I had 100-- 258 00:14:08,810 --> 00:14:10,890 250. 259 00:14:10,890 --> 00:14:14,400 So that matches the not 200 part, 260 00:14:14,400 --> 00:14:19,350 but if my community was 1000:1-- 261 00:14:19,350 --> 00:14:22,950 once again, that still wouldn't pass the criteria because the 262 00:14:22,950 --> 00:14:26,650 or is now on the not part of it. 263 00:14:26,650 --> 00:14:29,940 So, as you can see, just with changing the parentheses 264 00:14:29,940 --> 00:14:32,760 around a little bit, we have completely 265 00:14:32,760 --> 00:14:36,840 changed the meaning of this statement three different ways 266 00:14:36,840 --> 00:14:39,510 with the exact same statements. 267 00:14:39,510 --> 00:14:41,970 The only difference is the parentheses, 268 00:14:41,970 --> 00:14:45,450 and it completely changes what these matches mean. 269 00:14:45,450 --> 00:14:48,450 This is why it's so important to understand how the parentheses 270 00:14:48,450 --> 00:14:53,030 work, the and, the not, and the or. 271 00:14:53,030 --> 00:14:58,030 So, in this video, we talked a bit about the structure of RPO. 272 00:14:58,030 --> 00:15:00,850 We talked about the different operators we have, 273 00:15:00,850 --> 00:15:04,780 our Boolean variables, if-then-else statements. 274 00:15:04,780 --> 00:15:07,270 So now what we're going to do is move 275 00:15:07,270 --> 00:15:10,540 on to some of the more advanced features of RPO 276 00:15:10,540 --> 00:15:12,380 in our next video. 277 00:15:12,380 --> 00:15:16,060 Until then, I hope this has been informative for you, 278 00:15:16,060 --> 00:15:19,140 and I'd like to thank you for viewing. 279 00:15:19,140 --> 00:15:23,000