Changes between Version 18 and Version 19 of GEC17Agenda/AdvancedOpenFlow/Procedure/Execute


Ignore:
Timestamp:
11/21/13 16:45:39 (6 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC17Agenda/AdvancedOpenFlow/Procedure/Execute

    v18 v19  
    4040 
    4141=== 2.2. Configure !LabWiki to orchestrate and monitor your experiment ===
    42    - '''2.2.1''' Log on to !LabWiki on http://emmy9.casa.umass.edu:4000 , on the `Prepare` Column, type "gec17" and choose `gec17-advOF-script.rb` file.
     42   - '''2.2.1''' Log on to !LabWiki on http://emmy9.casa.umass.edu:4000 , on the `Prepare` Column, create a new Ruby script by clicking on the '+' at the top of the column. Add the script below to the new file, e.g
     43{{{
     44
     45
     46defApplication('oml:app:trace', 'trace') do |app|
     47
     48  app.version(2, 10, 0)
     49  app.shortDescription = 'Packet capture'
     50  app.description = %{'trace' uses libtrace to capture packets matching the
     51BPFilter, and report various header (IP, TCP, UDP, Radiotap,...) fields through
     52OML.
     53
     54Note The pktid field in all MPs can be used to link information about the
     55multiple protocols encapsulated in the same packet, even in cases where multiple
     56packets have been received at the same time, which renders the timestamp field
     57useless as an identifier.
     58  }
     59  app.path = "/usr/bin/trace"
     60
     61  app.defProperty('filter', 'Filter expression BPFEXP', '-f',
     62                  :type => :string, :mnemonic => 'f')
     63  app.defProperty('snaplen', 'Snarf Bytes of data from each  packet', '-s',
     64                  :type => :int, :unit => 'Bytes', :mnemonic => 's')
     65  app.defProperty('promisc', 'Put  the  interface into promiscuous mode', '-p',
     66                  :type => 'boolean', :mnemonic => 'p')
     67  app.defProperty('interface', 'Interface to trace', '-i',
     68                  :type => :string, :mnemonic => 'i', :default => '"eth0"')
     69  app.defProperty('radiotap', 'Enable radiotap', '-r',
     70                  :type => 'boolean', :mnemonic => 'r')
     71  app.defProperty('config', 'config file to follow', '--oml-config',
     72                  :type => :string, :default => '"/tmp/monitor/conf.xml"')
     73
     74
     75  app.defMeasurement("ip") do |m|
     76    m.defMetric('pktid',    :int, ' internal packet ID to link MPs')
     77    m.defMetric('ip_tos',   :int, ' Type of Service')
     78    m.defMetric('ip_len',   :int, ' Total Length')
     79    m.defMetric('ip_id',    :int,  ' Identification')
     80    m.defMetric('ip_off',   :int, ' IP Fragment offset (and flags)')
     81    m.defMetric('ip_ttl',   :int, ' Time to Live')
     82    m.defMetric('ip_proto', :int, ' Protocol')
     83    m.defMetric('ip_sum',   :int, ' Checksum')
     84    m.defMetric('ip_src',   :string, ' Source Address')
     85    m.defMetric('ip_dst',   :string, ' Destination Address')
     86    m.defMetric('ip_sizeofpacket', :int, ' Size of the Packet')
     87    m.defMetric('ip_ts',    :float, ' timestamp of the measurement')
     88  end
     89 
     90  app.defMeasurement("tcp") do |m|
     91    m.defMetric('pktid',        :int, ' internal packet ID to link MPs')
     92    m.defMetric('tcp_source',   :int, ' Source Port')
     93    m.defMetric('tcp_dest',     :int, ' Destination Port')
     94    m.defMetric('tcp_seq',      :int, ' TCP sequence Number')
     95    m.defMetric('tcp_ack_seq',  :int, ' Acknowledgment Number')
     96    m.defMetric('tcp_window',   :int, ' Window Size')
     97    m.defMetric('tcp_checksum', :int, ' Checksum')
     98    m.defMetric('tcp_urgptr',   :int, ' Urgent Pointer')
     99    m.defMetric('tcp_packet_size', :int, ' Size of the Packet')
     100    m.defMetric('tcp_ts',       :float, ' timestamp of the measurement')
     101  end
     102 
     103end
     104
     105
     106
     107defApplication('nmetrics_app', 'nmetrics') do |app|
     108
     109  app.version(2, 10, 0)
     110  app.shortDescription = 'Monitoring node statistcs'
     111  app.description = %{'nmetrics' is monitoring various node specific statistics,
     112such as CPU, memory and network usage and reports them through OML.
     113  }
     114  app.path = "/usr/bin/nmetrics"
     115
     116  app.defProperty('interface', 'Report usage for the specified network interface (can be used multiple times)', '-i',
     117          :type => :string, :mnemonic => 'i',
     118          :default => '"eth0"', :var_name => 'if_name')
     119  app.defProperty('sample-interval', 'Time between consecutive measurements', '-s',
     120          :type => :int, :unit => 'seconds', :mnemonic => 's',
     121          :var_name => 'sample_interval')
     122
     123  app.defMeasurement("network") do |m|
     124    m.defMetric('name', :string)
     125    m.defMetric('rx_packets', :int)
     126    m.defMetric('rx_bytes', :int)
     127    m.defMetric('rx_errors', :int)
     128    m.defMetric('rx_dropped', :int)
     129    m.defMetric('rx_overruns', :int)
     130    m.defMetric('rx_frame', :int)
     131    m.defMetric('tx_packets', :int)
     132    m.defMetric('tx_bytes', :int)
     133    m.defMetric('tx_errors', :int)
     134    m.defMetric('tx_dropped', :int)
     135    m.defMetric('tx_overruns', :int)
     136    m.defMetric('tx_collisions', :int)
     137    m.defMetric('tx_carrier', :int)
     138    m.defMetric('speed', :int)
     139  end
     140
     141  app.defMeasurement("procs") do |m|
     142    m.defMetric('cpu_id', :int)
     143    m.defMetric('total', :int)
     144    m.defMetric('sleeping', :int)
     145    m.defMetric('running', :int)
     146    m.defMetric('zombie', :int)
     147    m.defMetric('stopped', :int)
     148    m.defMetric('idle', :int)
     149    m.defMetric('threads', :int)
     150  end
     151
     152  app.defMeasurement("proc") do |m|
     153    m.defMetric('pid', :int)
     154    m.defMetric('start_time', :int)
     155    m.defMetric('user', :int)
     156    m.defMetric('sys', :int)
     157    m.defMetric('total', :int)
     158  end
     159end
     160#COMMENT
     161defPrototype("system_monitor") do |p|
     162  p.name = "System Monitor"
     163  p.description = "A monitor that reports stats on the system's resource usage"
     164  p.defProperty('monitor_interface', 'Monitor the interface usage', 'eth1')
     165  p.defProperty('sample-interval', 'sample-interval', '1')
     166
     167  p.addApplication("nmetrics_app") do |a|
     168    a.bindProperty('interface', 'monitor_interface')
     169    a.bindProperty('sample-interval', 'sample-interval')
     170    a.measure('network', :samples => 1)
     171  end
     172end
     173
     174
     175
     176
     177
     178###### Change the following to the correct interfaces ######
     179left = 'eth1'
     180right = 'eth2'
     181###### Change the above to the correct interfaces ######
     182
     183##definition of Sender, Receiver and Monitors
     184defProperty('source','outside','ID of sender node')
     185defProperty('sink', 'inside', "ID of receiver node")
     186defProperty ('balancer', 'switch', "ID of the load balancer")
     187defProperty('graph', true, "Display graph or not")
     188
     189defGroup('Sender', property.source) do |node|
     190end
     191
     192defGroup('Receiver', property.sink) do |node|
     193end
     194#measure the total bytes sent out and the total throughput on left path
     195defGroup('Monitor', property.balancer) do |node|
     196  node.addApplication("oml:app:trace") do |app|
     197    app.setProperty("interface", left)
     198    app.setProperty("config", "/tmp/monitor/conf.xml")
     199    app.measure("tcp", :samples => 1)
     200  end
     201  options = { 'sample-interval' => 1, 'monitor_interface' => left }
     202  node.addPrototype("system_monitor", options)
     203end
     204#measure the total bytes sent out and the total throughput on right path
     205defGroup('Monitor1', property.balancer) do |node|
     206  node.addApplication("oml:app:trace") do |app|
     207    app.setProperty("interface", right)
     208    app.setProperty("config", "/tmp/monitor/conf.xml")
     209    app.measure("tcp", :samples => 1)
     210  end
     211  options = { 'sample-interval' => 1, 'monitor_interface' => right }
     212  node.addPrototype("system_monitor", options)
     213end
     214
     215
     216
     217##experiment starts here##
     218onEvent(:ALL_UP_AND_INSTALLED) do |event|
     219  info "starting the monitor"
     220  group('Monitor').startApplications
     221  group('Monitor1').startApplications
     222 
     223  info "Starting the Receiver"
     224  group('Receiver').exec("iperf -s")
     225  wait 2
     226
     227  #--------------------------------------------------------------------
     228  #info "***********starting Load Balancer************"
     229  #group('Monitor').exec("/opt/trema-trema-f995284/trema run /root/load-balancer.rb > /tmp/lb.tmp")
     230  #wait 2
     231  #info "connecting switch to load balancer controller"
     232  #group('Monitor').exec("ovs-vsctl set-controller br0 tcp:127.0.0.1 ptcp:6634:127.0.0.1")
     233  #wait 5
     234 
     235  $i = 1
     236  $exp_time = 100
     237  $interval = 5
     238  $total = $exp_time / $interval
     239  while $i <= $total do
     240    info "Starting Sender " + $i.to_s
     241    group('Sender').exec("iperf -c 10.10.10.2 -t "+ ($exp_time-$i*$interval).to_s)
     242    wait $interval
     243    $i += 1
     244  end
     245   
     246  info "All applications started..."
     247    wait $interval
     248
     249  #info "************stoping Load Balancer***************"
     250  #group('Monitor').exec("killall ruby")
     251  #group('Monitor').exec("rm /opt/trema-trema-f995284/tmp/pid/LoadBalancer.pid")
     252  #info "remove switch-to-controller connection"
     253  #group('Monitor').exec("ovs-vsctl del-controller br0")
     254   
     255  info "All applications stopped."   
     256  allGroups.stopApplications
     257  Experiment.done
     258end
     259
     260 
     261##define the graphs that we want to display##
     262defGraph 'Cumulated number of Bytes' do |g|
     263  g.ms('network').select(:oml_ts_server, :tx_bytes, :oml_sender_id)
     264  g.caption "Total Bytes"
     265  g.type 'line_chart3'
     266  g.mapping :x_axis => :oml_ts_server, :y_axis => :tx_bytes, :group_by => :oml_sender_id
     267  g.xaxis :legend => 'timestamp', :ticks => {:format => 's'}
     268  g.yaxis :legend => 'sent Bytes', :ticks => {:format => 'Byte'}
     269end
     270 
     271defGraph 'TCP Throughput Bytes-per-Second' do |g|
     272  g.ms('tcp').select(:oml_ts_server, :tcp_throughput_sum, :oml_sender_id)
     273  g.caption "TCP throughput"
     274  g.type 'line_chart3'
     275  g.mapping :x_axis => :oml_ts_server, :y_axis => :tcp_throughput_sum, :group_by => :oml_sender_id
     276  g.xaxis :legend => 'timestamp', :ticks => {:format => 's'}
     277  g.yaxis :legend => 'throughput', :ticks => {:format => 'Bytes/s'}
     278end 
     279
     280}}}
    43281   - '''2.2.2''' On the terminal where you are logged in on node "Switch", rerun "ifconfig" to see the IP addresses on each interface.
    44282    [[BR]][[Image(GENIExperimenter/Tutorials/Graphics:warning-icon-hi.png,5%)]] You may not be able to see all interfaces up immediately when node "Switch" is ready; wait for some more time (about 1 min) then try "ifconfig" again.