WEBVTT

1
00:00.000 --> 00:04.360
So friends, let's take a look at some other file formats, namely XML.

2
00:04.360 --> 00:09.220
And one that we have briefly looked at, this one is YAML but we'll look at it

3
00:09.220 --> 00:10.560
in a little bit more detail.

4
00:10.560 --> 00:15.860
So let's first start off with XML. So this is known as the Extensible Markup

5
00:15.860 --> 00:16.560
Language.

6
00:16.560 --> 00:20.820
Now one thing to note about XML is that there is an extensive use, if you will

7
00:20.820 --> 00:21.680
excuse the pun,

8
00:21.680 --> 00:25.800
an extensive use of these particular arrows, see this year.

9
00:25.800 --> 00:28.560
Here we have our opening arrow and our closing arrow.

10
00:28.560 --> 00:32.160
In XML, speak, these are basically referred to as tags.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

10
00:28.560 --> 00:32.160
In XML, speak, these are basically referred to as tags.

11
00:32.160 --> 00:36.720
And pretty much these tags are used to describe the structure of our data.

12
00:36.720 --> 00:40.270
And then within the tags, we're going to have actual data that we can work with

13
00:40.270 --> 00:40.480
.

14
00:40.480 --> 00:44.630
Now one thing to state is XML is apparently human readable, at least it was

15
00:44.630 --> 00:45.280
designed to be,

16
00:45.280 --> 00:49.920
but in my opinion, I think it is an absolute headache to look at.

17
00:49.920 --> 00:54.240
Okay, okay, I must admit, you still can read the data, especially if you only

18
00:54.240 --> 00:55.840
have a little bit of it.

19
00:55.840 --> 01:00.200
But honestly, if you get a really large set of data and it's all formatted in
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

19
00:55.840 --> 01:00.200
But honestly, if you get a really large set of data and it's all formatted in

20
01:00.200 --> 01:00.640
XML,

21
01:00.640 --> 01:04.190
trying to read it yourself, I'm man, you're just asking for a migraine, it

22
01:04.190 --> 01:06.480
really is quite a lot.

23
01:06.480 --> 01:10.270
Now the reason why I'm even bringing this up is that it happens to be the file

24
01:10.270 --> 01:10.800
format

25
01:10.800 --> 01:13.360
utilized in the netcon protocol pretty much.

26
01:13.360 --> 01:16.400
This is one of the more modern interfaces for network automation.

27
01:16.400 --> 01:20.380
And later on within this course, we will actually look at netcon in a little

28
01:20.380 --> 01:21.280
bit more detail.

29
01:21.280 --> 01:24.560
So really all I'm doing is planting a seed and prepping the ground,

30
01:24.560 --> 01:27.950
kind of slowly introducing you into the concept of what we're talking about

31
01:27.950 --> 01:28.400
here.

32
01:28.400 --> 01:31.600
So let me just briefly show you how the data would look.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

32
01:28.400 --> 01:31.600
So let me just briefly show you how the data would look.

33
01:31.600 --> 01:34.720
This time not formatted in JSON, but instead XML.

34
01:34.720 --> 01:37.920
Okay, okay, so this is pretty much the same information once again.

35
01:37.920 --> 01:42.240
You can see the extensive use of these arrows, which ultimately make your tags

36
01:42.240 --> 01:43.280
notice this, okay?

37
01:43.280 --> 01:44.800
Here's the key distinction of XML.

38
01:44.800 --> 01:48.880
We have our opening tag, for example, so we have a little arrows, then the tag

39
01:48.880 --> 01:49.280
within,

40
01:49.280 --> 01:53.520
that is the opening tag, and then the corresponding closing tag is pretty much

41
01:53.520 --> 01:53.920
the same,

42
01:53.920 --> 01:55.760
but it also has a forward slash in it.

43
01:55.760 --> 01:56.480
See that right there?

44
01:56.480 --> 02:00.110
So this one opens it, and when we add the forward slash, that is the one to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

44
01:56.480 --> 02:00.110
So this one opens it, and when we add the forward slash, that is the one to

45
02:00.110 --> 02:00.560
close it.

46
02:00.560 --> 02:04.080
And anything within here is ultimately this set of data.

47
02:04.080 --> 02:06.480
So pretty much here is the VLANs right here.

48
02:06.480 --> 02:08.960
We can see the opening tag for the name, the closing tag.

49
02:08.960 --> 02:12.480
Inside, we actually have data, which is the name marketing.

50
02:12.480 --> 02:15.520
Again, we have an opening tag of number, closing tag of number.

51
02:15.520 --> 02:19.840
Inside within once again, we have our value, the number 10.

52
02:19.840 --> 02:21.680
Same thing is true for SVI.

53
02:21.680 --> 02:25.040
Here's the closing tag, and here is the data for IP address and subnet mask,

54
02:25.040 --> 02:28.800
and again, if I just happen to say, for example, scroll on out a little bit.

55
02:28.800 --> 02:29.840
We can see the data right here.

56
02:29.840 --> 02:34.120
Now, one thing to note about XML is once again, it is not dependent on white
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

56
02:29.840 --> 02:34.120
Now, one thing to note about XML is once again, it is not dependent on white

57
02:34.120 --> 02:34.400
space,

58
02:34.400 --> 02:36.640
and it does not care about indentation.

59
02:36.640 --> 02:40.610
So whilst this has been rather neatly formatted, I suppose neatly in a loose

60
02:40.610 --> 02:41.600
sense of the word,

61
02:41.600 --> 02:45.520
to have this type of nested hierarchical structure, this is not actually a

62
02:45.520 --> 02:46.480
feature of XML,

63
02:46.480 --> 02:49.440
it doesn't actually mandate that this data has to be this way.

64
02:49.440 --> 02:52.000
In fact, what I could do is encourage it.

65
02:52.000 --> 02:54.720
As you could easily have all your data just like this,

66
02:54.720 --> 02:57.440
no indentation, because like I say, it does not actually matter.

67
02:57.440 --> 02:58.640
XML does not care.

68
02:58.640 --> 03:01.440
This is just as valid as the previous layout.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

68
02:58.640 --> 03:01.440
This is just as valid as the previous layout.

69
03:01.440 --> 03:05.940
It's just a little bit more difficult for us as humans to eyeball and read this

70
03:05.940 --> 03:06.720
information.

71
03:06.720 --> 03:09.680
But crucially, like I say, it doesn't break the actual data.

72
03:09.680 --> 03:11.600
Now, one thing I will say about XML,

73
03:11.600 --> 03:14.320
is when it comes to having data stored in this format,

74
03:14.320 --> 03:17.840
that is a super, do-per-powerful and efficient way to query

75
03:17.840 --> 03:21.360
very particular piece of information held in this format.

76
03:21.360 --> 03:24.480
And this is something known as X-path filtering.

77
03:24.480 --> 03:27.680
Now, I'm not going to go into the details of X-path, it can be quite involved,

78
03:27.680 --> 03:28.960
it can be quite detailed.

79
03:28.960 --> 03:32.640
But just understand, despite the fact that this looks like a bit of a mess,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

79
03:28.960 --> 03:32.640
But just understand, despite the fact that this looks like a bit of a mess,

80
03:32.640 --> 03:37.040
programmatically, we can draw all sorts of correlations between very particular

81
03:37.040 --> 03:37.680
pieces of data

82
03:37.680 --> 03:41.040
within here and parse out information super precisely.

83
03:41.040 --> 03:44.960
So what I'm saying here is, is that it does have some very particular benefits.

84
03:44.960 --> 03:48.400
Okay, so that will do us from now on XML, we don't want to get a headache.

85
03:48.400 --> 03:50.320
Let's look at the more friendly one.

86
03:50.320 --> 03:52.320
This time we'll look at YAML data.

87
03:52.320 --> 03:56.800
Okay, okay, here is the same information, structured, utilising YAML.

88
03:56.800 --> 03:58.240
Now, how much nicer does this look?

89
03:58.240 --> 04:00.160
How much easier is this on the eye?
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

89
03:58.240 --> 04:00.160
How much easier is this on the eye?

90
04:00.160 --> 04:03.600
After looking at XML, this is like getting a good massage, honestly.

91
04:03.600 --> 04:04.960
It's just so much better.

92
04:04.960 --> 04:08.560
Okay, so big difference between JSON and XML with YAML,

93
04:08.560 --> 04:11.200
YAML is super sensitive to white space.

94
04:11.200 --> 04:13.360
If you happen to change the indentation,

95
04:13.360 --> 04:17.360
you can very easily break your YAML or at least completely alter the way the

96
04:17.360 --> 04:18.720
data has been structured.

97
04:18.720 --> 04:23.200
So white space and as we can see here, indentation is obviously very important.

98
04:23.200 --> 04:26.720
Now, one thing to state here with respect to JSON and YAML,

99
04:26.720 --> 04:28.400
both are fairly human readable.

100
04:28.400 --> 04:31.680
YAML being more so in my opinion, more people's opinion.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

100
04:28.400 --> 04:31.680
YAML being more so in my opinion, more people's opinion.

101
04:31.680 --> 04:35.760
Now, one thing you cannot do in JSON is you actually cannot write comments.

102
04:35.760 --> 04:38.160
This is not actually possible within these documents.

103
04:38.160 --> 04:40.800
However, when it comes to YAML,

104
04:40.800 --> 04:43.840
we can absolutely inject comments into our configurations.

105
04:43.840 --> 04:46.960
So this is very, very useful for, say, for example,

106
04:46.960 --> 04:50.820
storing your configuration data, because what you can do is you can annotate

107
04:50.820 --> 04:51.760
this information

108
04:51.760 --> 04:55.600
with some context and not have actually effect the document itself.

109
04:55.600 --> 04:59.680
So, say, for example, what I could do here is add a hash tag that's now known.

110
04:59.680 --> 05:03.280
And anything after here is going to be accepted by YAML as a comment,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

110
04:59.680 --> 05:03.280
And anything after here is going to be accepted by YAML as a comment,

111
05:03.280 --> 05:04.320
basically ignored.

112
05:04.320 --> 05:07.360
So it's just here for your own context and annotation.

113
05:07.360 --> 05:11.440
So I could annotate this with saying, you know, using private IP addresses,

114
05:11.440 --> 05:12.880
because it's a test.

115
05:12.880 --> 05:16.880
Whatever it may be, maybe you want to say all SVIs,

116
05:16.880 --> 05:20.720
must use the first available address and the network range.

117
05:20.720 --> 05:23.600
The actual examples here are trivial.

118
05:23.600 --> 05:24.560
Doesn't actually matter.

119
05:24.560 --> 05:28.240
The point is is that if you use this particular file format,

120
05:28.240 --> 05:31.520
say, for example, for modeling your configurations,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

120
05:28.240 --> 05:31.520
say, for example, for modeling your configurations,

121
05:31.520 --> 05:35.520
then say, for example, you want a junior engineer to make an update to the

122
05:35.520 --> 05:36.080
network.

123
05:36.080 --> 05:39.760
What the cool thing is is that the junior engineer can just modify this very

124
05:39.760 --> 05:40.720
readable file.

125
05:40.720 --> 05:43.200
It's much easier for a junior engineer to interpret,

126
05:43.200 --> 05:46.880
but more importantly, we can leave very specific notes about particular

127
05:46.880 --> 05:47.920
configurations

128
05:47.920 --> 05:50.720
that add additional context and give direction.

129
05:50.720 --> 05:51.760
Very, very useful.

130
05:51.760 --> 05:55.040
Now, these three file formats are not the only types you can use for data

131
05:55.040 --> 05:56.000
serialization,

132
05:56.000 --> 05:58.400
but in the world of network automation,

133
05:58.400 --> 06:02.800
JSON, XML and YAML are certainly the most common ones that you're going to see.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

133
05:58.400 --> 06:02.800
JSON, XML and YAML are certainly the most common ones that you're going to see.

134
06:02.800 --> 06:05.040
So it's a good idea to become familiar with them,

135
06:05.040 --> 06:08.400
so that when you inevitably stumble upon these file formats,

136
06:08.400 --> 06:10.800
well, they don't trip you up and confuse you.
