Changes between Version 1 and Version 2 of GENIEducation/SampleAssignments/IPRouting/ProcedureWithAnsible


Ignore:
Timestamp:
06/08/16 14:33:34 (5 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIEducation/SampleAssignments/IPRouting/ProcedureWithAnsible

    v1 v2  
    99
    1010<h3 align="left"> <u>Overview: </u> </h3>
    11 In this experiment you will learn how to set up static routing with the <em>route</em> command. We will orchestrate this experiment in LabWiki and use the ping command to verify connectivity.  We will use the following network topology for this experiment:
     11In this experiment you will learn how to set up static routing with the <em>route</em> command. We will orchestrate this experiment in Ansible and use the ping command to verify connectivity.  We will use the following network topology for this experiment:
    1212<br>
    1313<img border="0" src="http://groups.geni.net/geni/attachment/wiki/GENIEducation/SampleAssignments/IPRouting/Procedure/routetopology.png?format=raw" alt="route topology"  align="center" width="350" title="route topology" />
     
    2222       <li>  be familiar with <b><a href="http://groups.geni.net/geni/wiki/HowTo/LoginToNodes" > logging in to GENI resources </a> </b> </li>
    2323       <li> be familiar with <b> IPv4 addressing and routing </b> </li>
     24       <li> Familiarity with running Ansible playbooks. For an introductory tutorial, refer to the <a href="http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/AnsibleHelloGENI"> Ansible HelloGENI tutorial</a> </li>
    2425   </ul>
    2526
     
    6970    </ol>
    7071           <b>Action:Take a screenshot of your slice when all the nodes are ready and include it in your write up</b>
    71   <h3><u>3. LabWiki Plan </u></h3>
     72  <h3><u>3. Ansible Login </u></h3>
    7273   <ol>
    73       <li> Click on the "LabWiki" button on the Slice page </li>
    74        <li> You will be asked to login with openID. Please accept and your browser will then show the three panels of LabWiki; Plan, Prepare and Execute </li>
    75         <li> Type in ipfwd_tutorial in the search bar of the Plan column and you will see a nice set of instructions on how to run this experiment. This window also serves as a nice place to save your experiment results (graphs) and submit it as an assignment. To edit this document which is in [http://daringfireball.net/projects/markdown/ Markdown] format, click and drag the icon in the top left corner to the Prepare window.</li>
    76        <b>Note:  By default, this script is read-only. You will have to create your own copy for editing. You can do this in the Prepare column by clicking on the little wheel in the top left corner and selecting 'Wiki' as script type</b>
     74<li>If you have Omni installed on your machine use the command <i>"$readyToLogin MYSLICE --useSliceAggregates --ansible-inventory -o" </i> to create an inventory for the Ansible playbook and proceed to Step 4.</li>
     75      <li> If you do not have Omni installed, click on the "Details" button on the Slice page in the GENI Portal</li>
     76       <li> Scroll to the bottom of the screen and click on the link "Show Ansible Inventory" </li>
     77        <li> Using your favorite text editor, save the output to a file called <i> inventory </i> </li>
    7778    </ol>
    7879                 
    7980          </td>
    8081       </tr>
    81 </table>
    82 }}}
    83 
    84 [[BR]]
    85 
    86 {{{
    87 #!html
    88 <table  border="0" cellpadding="0" cellspacing="0">
    89   <tr>
    90      <td valign="top" align="left">
    91         <img src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/execute.png?format=raw" height="150" alt="Execute"></a>
    92       </td>
    93       <td>
    94          <h3><u> 4. Test connectivity using ping </u></h3>
    95          <ol>
    96                <li>In the search bar of the Prepare column, type in "step1_threenode.oedl" and select it. Click and drag the icon in the leftmost corner over to the Execute column</li>
    97 
    98               <img src="http://groups.geni.net/geni/attachment/wiki/GENIEducation/SampleAssignments/IPRouting/ProcedureWithLabWiki/3nodeprepare.png?format=raw" height="400" width = "700" alt="Three node">
    99 
    100                <li>Select your slice from the dropdown list and click on the "Start Experiment" at the bottom of the Execute panel</li>
    101                    
    102                   <b>Action:Click and drag the graph over to your Markdown</b>   
    103                    <p></p>
    104                    <p></p>
    105              <img src="http://groups.geni.net/geni/attachment/wiki/GENIEducation/SampleAssignments/IPRouting/ProcedureWithLabWiki/iproutegraph.png?format=raw" height="400" width = "700" alt="Three node">
    106          </ol>
    107 
     82The following steps (4-6) are all part of a single Ansible playbook. The entire script can be found <a href="https://github.com/dbhat/VirtualCL/blob/master/Assignments/IP%20forwarding/ansible_IProute.yml">at this link</a>. Here, we provide an explanation for the relevant sections of the script.
     83<h3><u> 4. Test connectivity using ping </u></h3>
     84
     85}}}
     86This  sections checks the local connectivity of each node to its neighboring node.
     87{{{
     88- name: test NodeA
     89   hosts: NodeA
     90   sudo: True
     91   tasks:
     92    - name: ping seta1
     93       shell:  "ping -c 5 192.168.1.11"
     94       register: pingA1_test
     95       failed_when: "'Timeout' in pingA1_test.stdout_lines"
     96    - debug: var=pingA1_test.stdout_lines
     97    - name: ping seta2
     98       shell:  "ping -c 5 192.168.3.12"
     99       register: pingA2_test
     100       failed_when: "'Timeout' in pingA2_test.stdout_lines"
     101    - debug: var=pingA2_test.stdout_lines
     102 
     103- name: test NodeB
     104  hosts: NodeB
     105  sudo: True
     106  tasks:
     107   - name: ping setb1
     108      shell:  "ping -c 5 192.168.1.10"
     109      register: pingB1_test
     110      failed_when: "'Timeout' in pingB1_test.stdout_lines"
     111   - debug: var=pingB1_test.stdout_lines
     112   - name: ping setb2
     113      shell:  "ping -c 5 192.168.2.12"
     114      register: pingB2_test
     115      failed_when: "'Timeout' in pingB2_test.stdout_lines"
     116   - debug: var=pingB2_test.stdout_lines
     117   
     118- name: test NodeC
     119  hosts: NodeC
     120  sudo: True
     121  tasks:
     122   - name: ping setc1
     123      shell:  "ping -c 5 192.168.3.10"
     124      register: pingC1_test
     125      failed_when: "'Timeout' in pingC1_test.stdout_lines"
     126   - debug: var=pingC1_test.stdout_lines
     127   - name: ping setc2
     128      shell:  "ping -c 5 192.168.2.11"
     129      register: pingC2_test
     130      failed_when: "'Timeout' in pingC2_test.stdout_lines"
     131   - debug: var=pingC2_test.stdout_lines
     132               
     133}}}
     134           
     135 {{{
     136#!html     
    108137         <h3><u> 5. Setup the routing </u></h3>
    109138         The goal of this exercise is to setup the routing as indicated in <a href="#IPv4RoutingAssignment">Figure 1</a>; i.e.  packets from A sent to IP address 192.168.2.12 on node C should be routed via node B. In order to create this routing behavior you will need to modify the routing tables in your nodes using the linux
    110139<a href ="http://www.hscripts.com/tutorials/linux-commands/route.html"> route command </a>
    111              <li> Bring up the script "step2_threenode.oedl" in your Prepare panel</li>
    112              <li>Create a copy of this script to add in the routing as part of your assignment</li>
     140}}}
     141
     142{{{
     143
     144#Enter static routing commands here
     145- name: route NodeA
     146  hosts: NodeA
     147  sudo: True
     148  tasks:
     149   - name: rout seta1
     150      shell:  ""
     151      register: routA1_test
     152   - debug: var=routA1_test.stderr_lines
     153 
     154- name: route NodeB
     155  hosts: NodeB
     156  sudo: True
     157  tasks:
     158   - name: rout setb1
     159      shell:  ""
     160      register: routB1_test
     161   - debug: var=routB1_test.stderr_lines
     162
     163- name: route NodeC
     164  hosts: NodeC
     165  sudo: True
     166  tasks:
     167   - name: rout setc1
     168      shell:  ""
     169      register: routC1_test
     170   - debug: var=routC1_test.stderr_lines
     171
     172
     173}}}
     174
     175{{{
     176#!html
    113177         <h4> Questions: </h4>
    114178             <ol>
     
    116180             </ol>
    117181        <h3><u> 6. Test routing using ping </u></h3>
    118          <ol>
    119                <li>In the search bar of the Prepare column, type in "step3_threenode.oedl" and select it. Click and drag the icon in the leftmost corner over to the Execute column</li>
    120                <li>Select your slice from the dropdown list and click on the "Start Experiment" at the bottom of the Execute panel</li>
    121                   <b>Action:Click and drag the graph over to your Markdown</b>   
    122          </ol>
     182       
    123183       
    124184
     
    127187</table>
    128188}}}
     189This part of the script is used to test the new route setup.
     190{{{
     191#Test New route setup
     192- name: testroute NodeA
     193  hosts: NodeA
     194  sudo: True
     195  tasks:
     196   - name: ping seta1
     197     shell:  "ping -c 5 192.168.2.12"
     198     register: pingA1_test
     199     failed_when: "'Timeout' in pingA1_test.stdout_lines"
     200   - debug: var=pingA1_test.stdout_lines
     201   
     202}}}
     203
    129204[[BR]]
    130205{{{