Brocade Automation Community

Video: Yang For Brocade SDN Controller RestConf Development

  • 1.  Video: Yang For Brocade SDN Controller RestConf Development

    Posted 04-11-2015 03:57 PM

    This video provides a high-level overview of YANG intended for folks doing RESTCONF development for Brocade SDN Controller.  It describes how to obtain YANG files and how YANG affects your RESTCONF development.

     

     

    More Info Links:

    Video Transcript:

     

    00:00:00.560 --> 00:00:03.040
    crack folks today wanna give you an
    overview

    00:00:03.040 --> 00:00:07.120
    jiang so what is yang and why do you
    care

    00:00:07.120 --> 00:00:10.179
    um everything

    00:00:10.179 --> 00:00:13.580
    in BBC and open daylight

    00:00:13.580 --> 00:00:17.100
    is based on yang so

    00:00:17.100 --> 00:00:21.689
    you don't absolutely have to understand
    if you don't want to understand it

    00:00:21.689 --> 00:00:25.410
    I'm you can just go work with the rest
    com interface

    00:00:25.410 --> 00:00:30.039
    and not know anything about yang I'm we
    suggest you use our postman collection

    00:00:30.039 --> 00:00:33.360
    because it makes it simpler for you
    knock an understanding but

    00:00:33.360 --> 00:00:38.200
    since everything is based on yang it's
    worth getting at least some

    00:00:38.200 --> 00:00:42.070
    understanding of you hangin where it's
    at what it's doing because

    00:00:42.070 --> 00:00:45.190
    it gives you a basis that you can then

    00:00:45.190 --> 00:00:49.600
    dig if you ever need Digg for something
    in in this video what I want to do is

    00:00:49.600 --> 00:00:50.289
    give you

    00:00:50.289 --> 00:00:53.930
    overview I'm not going to give you a
    deep deep understanding again but an

    00:00:53.930 --> 00:00:56.280
    overview of what it is how it affects
    you

    00:00:56.280 --> 00:00:59.300
    and how to dig around a little bit arm

    00:00:59.300 --> 00:01:03.730
    and I think that's gonna stand you in
    good stead in the future okay so let me

    00:01:03.730 --> 00:01:06.920
    try to generate a little motivation for
    why you should understand yang and how

    00:01:06.920 --> 00:01:07.760
    it can help you

    00:01:07.760 --> 00:01:12.970
    ago by a BBC and my many net I'm in is
    connected to maybe see oprah. login

    00:01:12.970 --> 00:01:17.450
    to my BBC here gonna bring up the
    browser I'm gonna bring up the BBC's Koo

    00:01:17.450 --> 00:01:17.990
    wee

    00:01:17.990 --> 00:01:23.180
    login admin admin and we're going to do
    is I'm gonna immediately go to you can

    00:01:23.180 --> 00:01:24.990
    explore some click Settings

    00:01:24.990 --> 00:01:27.990
    and I'm gonna go ahead and pick the APR
    explore

    00:01:27.990 --> 00:01:31.750
    that's all generated from yang by the
    way auto-generated so that's

    00:01:31.750 --> 00:01:34.900
    one motivation second here on cell
    remote

    00:01:34.900 --> 00:01:39.439
    arm this operation allows you to create
    a day to change in it says hey here's

    00:01:39.439 --> 00:01:40.150
    your model

    00:01:40.150 --> 00:01:43.770
    because it opposed to going to put some
    information in there and we put it in we

    00:01:43.770 --> 00:01:45.130
    clicked right out we get a giant

    00:01:45.130 --> 00:01:48.420
    error saying hey the input is no good
    and shortest

    00:01:48.420 --> 00:01:52.110
    you should scratch your head and say
    well I thought this thing was gonna

    00:01:52.110 --> 00:01:58.200
    help me do this what's going on and how
    do I fix that

    00:01:58.200 --> 00:02:01.000
    to Yanks gonna help you fix that problem

    00:02:01.000 --> 00:02:04.390
    first jump in and just take a look a
    gang file

    00:02:04.390 --> 00:02:08.570
    okay so don't worry where I got the
    skank power gonna talk about that what I

    00:02:08.570 --> 00:02:11.170
    want to do is talk about the structure
    being from what's in there

    00:02:11.170 --> 00:02:15.470
    a young filed the find a data model data
    model think it is just a

    00:02:15.470 --> 00:02:19.830
    database or tree which is basically
    showing you what values can be stored

    00:02:19.830 --> 00:02:23.240
    and what you can set and what you can
    read arm

    00:02:23.240 --> 00:02:27.800
    so here we see a container it contains
    groupings the grouping contain to leave

    00:02:27.800 --> 00:02:30.620
    them leaves is at the very bottom up the
    tree where you're putting

    00:02:30.620 --> 00:02:33.850
    also can define notifications which are
    generated events

    00:02:33.850 --> 00:02:37.290
    and our PCs which are things that it
    will do on your behalf

    00:02:37.290 --> 00:02:41.910
    was focus on our PCs when I wanna show
    you

    00:02:41.910 --> 00:02:45.280
    is how young file that defines an RPC

    00:02:45.280 --> 00:02:49.110
    is actually represented to you in some
    other tools you're currently using in

    00:02:49.110 --> 00:02:49.870
    particular

    00:02:49.870 --> 00:02:55.090
    the BBC postman collection okay so we're
    gonna open

    00:02:55.090 --> 00:02:59.310
    postman here if you don't know how to do
    that please go see our other video:

    00:02:59.310 --> 00:03:02.810
    we're gonna bring up our collection and
    then we're gonna go down here

    00:03:02.810 --> 00:03:06.560
    and this is just you know when postman
    we're just gonna do again operation

    00:03:06.560 --> 00:03:10.890
    for her to send so how's that related to
    Yang will you can see it has a list of

    00:03:10.890 --> 00:03:13.600
    operations and there's a bunch for open
    for pork roll

    00:03:13.600 --> 00:03:17.390
    colon something over here on our gang
    file which happens to be the OpenFlow

    00:03:17.390 --> 00:03:19.060
    protocol dot can file

    00:03:19.060 --> 00:03:22.910
    there's RPC define echo and sure enough

    00:03:22.910 --> 00:03:26.820
    in the list there's an open for protocol
    colon echo and then one for echo reply

    00:03:26.820 --> 00:03:29.970
    so that yang filed the fineness
    information it worse

    00:03:29.970 --> 00:03:32.780
    okay let me show you another way that
    hangs behind everything that you're

    00:03:32.780 --> 00:03:33.239
    doing

    00:03:33.239 --> 00:03:36.830
    okay so back in postman let's go to

    00:03:36.830 --> 00:03:41.470
    controller module to get marshals but a
    modulus earn as much in names and dates

    00:03:41.470 --> 00:03:44.610
    so where did those come from and what
    are they

    00:03:44.610 --> 00:03:48.980
    um if you actually look we're going to
    scroll down here

    00:03:48.980 --> 00:03:52.000
    we're gonna find a module for I'm

    00:03:52.000 --> 00:03:55.519
    Chernoff OpenFlow protocol remember yang
    files the operable protocol if we go to

    00:03:55.519 --> 00:03:56.140
    the top

    00:03:56.140 --> 00:04:00.660
    we're gonna find that in fact there's
    the OpenFlow protocol that matches

    00:04:00.660 --> 00:04:03.900
    revision number yeah that matches

    00:04:03.900 --> 00:04:06.300
    and what about those names based

    00:04:06.300 --> 00:04:11.710
    sure enough that's where these modules

    00:04:11.710 --> 00:04:15.320
    will grade everything's control by
    ankles but I'm told you how to get a

    00:04:15.320 --> 00:04:16.160
    gang file

    00:04:16.160 --> 00:04:19.310
    but starting with BBC 1.2 tonnes hero

    00:04:19.310 --> 00:04:23.600
    you can go down here under netcom
    there's an RPC

    00:04:23.600 --> 00:04:28.170
    forget a netcom module schema you can
    enter the identify our

    00:04:28.170 --> 00:04:32.010
    which is the name the gang file you want
    and I am

    00:04:32.010 --> 00:04:35.110
    so you go ahead and hit Send in ok

    00:04:35.110 --> 00:04:39.040
    we had their when I get up if I look

    00:04:39.040 --> 00:04:43.080
    saying hey there's a another available
    revision if I go back I

    00:04:43.080 --> 00:04:46.919
    look into my ankle yeah sure enough I
    need that so I'll hit

    00:04:46.919 --> 00:04:50.350
    send and now when I got back was

    00:04:50.350 --> 00:04:54.580
    the actual yang file I know it doesn't
    look like it but let me prove it to you

    00:04:54.580 --> 00:04:57.990
    so appear there's a copyright for
    pantheon I am

    00:04:57.990 --> 00:05:02.880
    and if I look there it is om I'm just
    moving the screens around so that will

    00:05:02.880 --> 00:05:04.570
    be able to see this a little bit better

    00:05:04.570 --> 00:05:08.730
    so there's the copyright for pantheon
    com and sure enough

    00:05:08.730 --> 00:05:12.080
    this is in fact that file there's the
    OpenFlow protocol

    00:05:12.080 --> 00:05:17.150
    call name there's the you are an so that
    is in fact the Yang file right there

    00:05:17.150 --> 00:05:20.850
    okay but that's pretty ugly there's got
    to be an easier way

    00:05:20.850 --> 00:05:24.100
    so if you install pie BBC

    00:05:24.100 --> 00:05:28.479
    and then gotten pie BBC samples and you
    know how do that there's another video

    00:05:28.479 --> 00:05:32.410
    check it out from that link up there I'm
    going into my pie BBC samples on going

    00:05:32.410 --> 00:05:34.040
    down into 1.0 2.0

    00:05:34.040 --> 00:05:37.690
    and there is a python file here that
    will do something for you

    00:05:37.690 --> 00:05:42.290
    controller scheme a star P Y the losers
    a folder here controller schema files

    00:05:42.290 --> 00:05:45.970
    I'm going to remove that folder and
    you'll see why here in a second I'm

    00:05:45.970 --> 00:05:47.120
    gonna actually go ahead

    00:05:47.120 --> 00:05:50.780
    I'm going to run controller schema stop
    you why

    00:05:50.780 --> 00:05:53.820
    first a rag I have to set the controller
    yeah more

    00:05:53.820 --> 00:05:57.410
    make sure your controller address is
    correct and the username and password is

    00:05:57.410 --> 00:05:59.110
    correct if that's all set up

    00:05:59.110 --> 00:06:02.320
    then you can go ahead and run controller
    schemas P Y

    00:06:02.320 --> 00:06:06.830
    what it's doing is actually going in
    making that call that we made in postman

    00:06:06.830 --> 00:06:09.850
    over and over and over and over and
    getting and putting

    00:06:09.850 --> 00:06:13.130
    all that information into a gang files
    in that subprime folder

    00:06:13.130 --> 00:06:16.490
    controller scheme files I'm so if we

    00:06:16.490 --> 00:06:19.660
    check here's controller schema files
    there's a new folder there

    00:06:19.660 --> 00:06:24.630
    I go down in there arm and I look oh my
    gosh there's a tiny yang files in here

    00:06:24.630 --> 00:06:29.200
    that's pretty cool and it has for matter
    that much more cleanly than you saw

    00:06:29.200 --> 00:06:33.640
    in postman so if I do ahead this is what
    we would expect to see in fact that's

    00:06:33.640 --> 00:06:36.330
    how I got the hang file that I was
    demonstrated to you

    00:06:36.330 --> 00:06:42.069
    you can compare it to the result that we
    got postman

    00:06:42.069 --> 00:06:45.479
    okay so let's just walk through that
    control scheme a star P why

    00:06:45.479 --> 00:06:48.580
    okay so how did we right this
    application

    00:06:48.580 --> 00:06:52.080
    this controller schemas and actually go
    and get all of the schema files and put

    00:06:52.080 --> 00:06:52.819
    them in files

    00:06:52.819 --> 00:06:56.559
    so here we are we load the animal file
    its just configuration

    00:06:56.559 --> 00:07:00.240
    um we create a controller that
    straightforward I get a list a young

    00:07:00.240 --> 00:07:02.349
    model supported by the controllers
    remember that

    00:07:02.349 --> 00:07:07.080
    get models that we did he basically went
    got every model that was out there

    00:07:07.080 --> 00:07:10.779
    and once we get that into an S list
    variable we're going to loop through

    00:07:10.779 --> 00:07:13.459
    each one of those and they were gonna
    say get the schema

    00:07:13.459 --> 00:07:16.939
    for every single one in that way and
    they were gonna put it in the file

    00:07:16.939 --> 00:07:20.279
    in a folder in that way we actually
    obtain

    00:07:20.279 --> 00:07:26.500
    every schema for every module that's
    defined by the BBC

    00:07:26.500 --> 00:07:29.430
    okay so what's playing Kang is a

    00:07:29.430 --> 00:07:32.650
    troll that if you're working with gang
    files this

    00:07:32.650 --> 00:07:37.139
    was the very first set of tools was
    created maybe not the very first but it

    00:07:37.139 --> 00:07:38.840
    was one of the first set of tools

    00:07:38.840 --> 00:07:42.500
    available to from work with the gang
    files

    00:07:42.500 --> 00:07:46.990
    its a very handy tool I'm going to use
    it for once very specific purpose that

    00:07:46.990 --> 00:07:49.340
    I'll show you here but first we need to
    install

    00:07:49.340 --> 00:07:54.570
    okay so we're gonna do is for GoPro
    browser I'm gonna go

    00:07:54.570 --> 00:07:59.530
    klenge download for Google Google will
    find us Code UCC Google Docs Kang

    00:07:59.530 --> 00:08:03.060
    which the projects move to get home so
    we'll go to a good home so you could

    00:08:03.060 --> 00:08:04.949
    probably is going to get her been typed
    Kang

    00:08:04.949 --> 00:08:08.770
    we're gonna grab the HTTPS URL over
    there on the right hand side

    00:08:08.770 --> 00:08:12.780
    arm and then find a directory where you
    want this to be

    00:08:12.780 --> 00:08:18.009
    and go there and then do get clone and
    then put in that paste in a URL we just

    00:08:18.009 --> 00:08:18.530
    copied

    00:08:18.530 --> 00:08:23.270
    that pulls it down and if I go into the
    pang folder that was just created

    00:08:23.270 --> 00:08:26.940
    I'm going to pseudo bite on

    00:08:26.940 --> 00:08:30.270
    setup picked up P Y

    00:08:30.270 --> 00:08:33.900
    space install that runs the setup

    00:08:33.900 --> 00:08:38.659
    command for pang installed can is a
    powerful tool but the one thing that I'm

    00:08:38.659 --> 00:08:40.539
    going to use it for is to convert

    00:08:40.539 --> 00:08:44.240
    yang file into something else in
    particular I'm going to convert yang

    00:08:44.240 --> 00:08:44.820
    files

    00:08:44.820 --> 00:08:49.279
    into a tree format and I'm gonna show
    you how to do that here in fact I have a

    00:08:49.279 --> 00:08:50.310
    little application

    00:08:50.310 --> 00:08:53.730
    so wanna go back to pie BBC samples

    00:08:53.730 --> 00:08:57.150
    I am n in pipe BBC samples

    00:08:57.150 --> 00:09:00.320
    we will find a python file called Kang

    00:09:00.320 --> 00:09:04.690
    underscore treed IP wifi go ahead

    00:09:04.690 --> 00:09:09.060
    and copy that into where the schema
    files member we created the schema files

    00:09:09.060 --> 00:09:11.459
    folder I just copy that Python file in
    there

    00:09:11.459 --> 00:09:14.500
    so now it's in there with all the
    Gentiles that's important because it

    00:09:14.500 --> 00:09:15.440
    assumes its

    00:09:15.440 --> 00:09:19.760
    in a folder copying files if we go ahead
    in cat that file

    00:09:19.760 --> 00:09:24.250
    the can't read up P why you can see what
    it's doing is it just goes in for every

    00:09:24.250 --> 00:09:26.450
    file in the folder in which it is

    00:09:26.450 --> 00:09:29.450
    it's going to call p.eng minus F

    00:09:29.450 --> 00:09:32.910
    tree on that file and then stick it in
    and help file

    00:09:32.910 --> 00:09:35.959
    this is going to go through every young
    file in here

    00:09:35.959 --> 00:09:38.899
    and run can minus have tree which will
    create

    00:09:38.899 --> 00:09:42.139
    a tree so let's go ahead and do that

    00:09:42.139 --> 00:09:46.240
    arm talking to Python can't read up you
    are you can see

    00:09:46.240 --> 00:09:49.730
    it's literally running through every
    yang file in this folder

    00:09:49.730 --> 00:09:54.149
    and its record running playing minor
    self tree and then it's out putting that

    00:09:54.149 --> 00:09:57.509
    output into a file which is Chang tree

    00:09:57.509 --> 00:10:01.809
    on dot text arm and you're seeing a
    couple warnings in here

    00:10:01.809 --> 00:10:07.029
    all all go through that that's because
    work and others also validates the gang

    00:10:07.029 --> 00:10:09.129
    file which is kinda interesting in that

    00:10:09.129 --> 00:10:12.240
    there are still some warnings out there
    and some other gang files but

    00:10:12.240 --> 00:10:16.990
    big their warnings it's no big deal I'm
    so for go back and we look

    00:10:16.990 --> 00:10:20.420
    I you can see that some of these things
    so they're thus

    00:10:20.420 --> 00:10:24.100
    there's the commands so these mornings
    are basically a there's something

    00:10:24.100 --> 00:10:25.490
    important that never used

    00:10:25.490 --> 00:10:30.269
    that's no big deal Nana fatal their
    anything okay so let's use those the

    00:10:30.269 --> 00:10:33.630
    tree that we just created to visualize
    and Mac

    00:10:33.630 --> 00:10:37.139
    so I bought my editor I'm gonna open my
    editor here and I'm going to open the

    00:10:37.139 --> 00:10:38.870
    file that we just created

    00:10:38.870 --> 00:10:42.070
    Sandra down into that's a poll it
    contained only and files find

    00:10:42.070 --> 00:10:47.170
    can't read a txt and open it which you
    can see here is just a list of modules

    00:10:47.170 --> 00:10:50.180
    each module that exists is in fact

    00:10:50.180 --> 00:10:53.430
    one of these modules is from one of the
    Shang files

    00:10:53.430 --> 00:10:58.079
    to reaching file generates a module and
    you can see that names match up

    00:10:58.079 --> 00:11:02.040
    exactly so there's our panhandler are
    peddler implementation

    00:11:02.040 --> 00:11:05.500
    so he's one of those what is it to find
    so there's something called

    00:11:05.500 --> 00:11:08.980
    augment which is basically that
    augmenting some other

    00:11:08.980 --> 00:11:14.380
    file schema on those notifications as we
    saw on the hanging file here's a list of

    00:11:14.380 --> 00:11:17.190
    all the notifications to find in that
    particular yang file

    00:11:17.190 --> 00:11:20.480
    there's RW which defines the actual

    00:11:20.480 --> 00:11:25.730
    data model not every young followers you
    see to find it bothers our PCs this

    00:11:25.730 --> 00:11:29.170
    particular module only defines our PCs
    and there's an input

    00:11:29.170 --> 00:11:35.139
    arm definition are okay so if there's an
    input definition on that RPC

    00:11:35.139 --> 00:11:40.899
    maybe we can solve the problem we saw at
    the very beginning at this video

    00:11:40.899 --> 00:11:43.790
    remember when the motivations are
    promised was that if you knew yang

    00:11:43.790 --> 00:11:46.089
    you're gonna be able to solve a problem
    so

    00:11:46.089 --> 00:11:49.329
    go back into maybe BC I'm gonna go to
    the UK I explore

    00:11:49.329 --> 00:11:52.810
    I'm gonna scroll down to sell remote
    here

    00:11:52.810 --> 00:11:55.860
    com and if i gol down to

    00:11:55.860 --> 00:11:59.870
    arm cell remote I'm gonna pick the RPC
    for

    00:11:59.870 --> 00:12:02.880
    creating a change for remember hey

    00:12:02.880 --> 00:12:06.550
    there was the scheme it says hey there's
    nothing if I try it out it gives me this

    00:12:06.550 --> 00:12:07.079
    error:

    00:12:07.079 --> 00:12:11.459
    and I said will thats to find somewhere
    to find any gang file somewhere

    00:12:11.459 --> 00:12:15.050
    so let's go poke around we're gonna go
    back and look

    00:12:15.050 --> 00:12:19.470
    at cell remote inside my can't read a
    txt which redefined and sure enough

    00:12:19.470 --> 00:12:22.560
    there is created change event
    subscription at an RPC

    00:12:22.560 --> 00:12:27.149
    it to find the import so in fact if we
    go

    00:12:27.149 --> 00:12:30.610
    I'm not gonna do it in the UK Explorer
    I'm gonna do it here in our chrome

    00:12:30.610 --> 00:12:34.170
    arm a BBC chrome collection

    00:12:34.170 --> 00:12:37.519
    so there's the cell create change RPC

    00:12:37.519 --> 00:12:42.050
    it matches up exactly their cell remote
    and created a change

    00:12:42.050 --> 00:12:46.040
    says the input here is a path and sure
    enough

    00:12:46.040 --> 00:12:49.060
    arm if I look in my collection there is
    a path there

    00:12:49.060 --> 00:12:53.880
    to find network topology call a network
    topology arm I wonder where we got that

    00:12:53.880 --> 00:12:54.510
    from

    00:12:54.510 --> 00:12:59.010
    well what's delete the other stuff just
    for now I'll explain it in a second

    00:12:59.010 --> 00:13:04.000
    but weird network topology corn that
    were too that also was defined by Yang

    00:13:04.000 --> 00:13:09.079
    if we poke around in this tree and we
    look for network topology

    00:13:09.079 --> 00:13:12.470
    arm apps wrong file

    00:13:12.470 --> 00:13:17.720
    hang on big pack

    00:13:17.720 --> 00:13:21.970
    think back to the tree and mommy let me
    do a search on network topology here

    00:13:21.970 --> 00:13:26.360
    comment will find out where to find so
    there's module network topology

    00:13:26.360 --> 00:13:29.800
    and the first thing in it is network
    topology so what that says is in issuing

    00:13:29.800 --> 00:13:31.060
    from network topology

    00:13:31.060 --> 00:13:34.590
    for module network topology fine network
    topology so

    00:13:34.590 --> 00:13:38.930
    that my path and i'm saying create me a
    day to change for anything that changes

    00:13:38.930 --> 00:13:40.350
    underneath that data

    00:13:40.350 --> 00:13:45.090
    and sure enough if i sended I get in OK
    non-arab like we did on the API Explorer

    00:13:45.090 --> 00:13:49.020
    what were those other two things in here
    this data store and scope I didn't see

    00:13:49.020 --> 00:13:50.290
    that may hang file

    00:13:50.290 --> 00:13:54.550
    where did those come from i sended it
    actually works but where they come from

    00:13:54.550 --> 00:13:58.580
    ok well there's another model just above
    your cell remote augment to this is an

    00:13:58.580 --> 00:14:02.540
    augmentation someone has to find more
    variables that allow you to control it

    00:14:02.540 --> 00:14:03.250
    more there

    00:14:03.250 --> 00:14:07.090
    optional variables but you can put them
    in arm and sure enough

    00:14:07.090 --> 00:14:11.520
    what it shows is yang gives you this
    strong partisan have otherwise

    00:14:11.520 --> 00:14:16.890
    the ability to determine information
    that was not available by the PI

    00:14:16.890 --> 00:14:21.450
    explore well thanks for listening and I
    hope that I've shown you some

    00:14:21.450 --> 00:14:25.850
    the power yang it's behind everything
    you're doing with PVC

    00:14:25.850 --> 00:14:30.280
    I am and there's a lot more to learn on
    Yankee if you wish to learn it

    00:14:30.280 --> 00:14:33.950
    there's a lot of ATF standards that you
    could go read but I wanted to give you

    00:14:33.950 --> 00:14:35.750
    just enough so you understood

    00:14:35.750 --> 00:14:40.300
    how yang was sort controlling everything
    that you're working with

    00:14:40.300 --> 00:14:41.320
    hope that helped


    #BrocadeAutomationCommunity