From a1487b8e3a45fb546c23b76e6c2d628c3fb7e511 Mon Sep 17 00:00:00 2001 From: reyk Date: Tue, 19 Jul 2016 17:19:58 +0000 Subject: [PATCH] Add two more tests that use traffic that was captured with tcpdump. These files serve as an example, no more .pcap files should be added here (especially not large ones). --- regress/usr.sbin/switchd/args-http.pcap | Bin 0 -> 4844 bytes regress/usr.sbin/switchd/args-http.pm | 63 ++++++++++++++++++++++++ regress/usr.sbin/switchd/args-icmp.pcap | Bin 0 -> 708 bytes regress/usr.sbin/switchd/args-icmp.pm | 47 ++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 regress/usr.sbin/switchd/args-http.pcap create mode 100644 regress/usr.sbin/switchd/args-http.pm create mode 100644 regress/usr.sbin/switchd/args-icmp.pcap create mode 100644 regress/usr.sbin/switchd/args-icmp.pm diff --git a/regress/usr.sbin/switchd/args-http.pcap b/regress/usr.sbin/switchd/args-http.pcap new file mode 100644 index 0000000000000000000000000000000000000000..0938907fb8e355b94293bfeda6b5f9ac6b0dfe1d GIT binary patch literal 4844 zcmaJ_2{@GN`+jH4Wb8B6L71^+HzQ<84YEtdE=vYuON=ogQDZOLv7L%^5JjRyMMYVT z5J^giGS-m2g`)gtI=}P(U3Grfnd^Gyn(uv|?|$y@zP{(XpKo5a)s{d34E+7+V+R1j zJTUgkbk_F-z=rvo6+kH{GNRFTJ^r@&7X&Z?fB^L)0K$$T<+d=P@HjfWRYVKeW};F4 ztmGOf0eHCr0ENMCLm)6HgpG|20zq)brcPXA?X%EtU4Z^S`d_$z)%Xh?LnHvz9Zv}? zWL5=WE22d-r|2;&1k~^ofb`@)(eWDr>Z}SZbg_IWFk)6>#Xq=fzP-WXzPa=Z_W))E zeL4~Wybdx|_zzzeDhu&o0Tf(hg0bQsh#4dV3-QF>|A~lZB3}I&(agjFqfVmI)G5dP z{7$gG@i?4|j<%YApdZHE!NFD?uZH8{G!G4@>0u%xBh^AFmc#PyvR%c!x59a|Ajk(}(oUDSu>tZaA2Q#tp+8F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%7EW2%_IOMPBV25>@ zkkPV}Ny@?YdP^C5!^4pn8p(yNLb40T&HO83d6#&0t*Bra`-2iVjw)rSfaPC<8`esF z9+$w>;@hzzSDNESg<~Dj!h;>EGi3s_VsR&i!RrzUB>xWmniQ#cWg0;&s1HG1Wsjq) z$L&s%@v#WrB>INX#UpJc22hestK#cd(A9Pcr3B$`NzzAl^D?}ml#RqmBypcy@yZM0 z^?0!$90D-V04Z8(EA)WEH3-${o;fqRcB;GreF>GGcbT&sl}0thcoLU=c zD0>TpZ}3x5X=nNn8GUHMRrHND_H2?cd+V_pWb9RRhW8Y|KT(8Ab-a=#LM95Cmq;E7 zx5f-fW?dGbU`6HZgxGV;GO5DO0huUbra-yL0X7W*dM$O;P@HuHm8H_3#bu#~ z!wT>ZpAqU3?$6G`K{6I@WlMw!U`nzC6m#xQ2q>M+aU&`>cII#g3gC2e2`D7cXLX$O azjoXi2CL(UP5 +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +package args_http; + +use strict; +use warnings; +use base qw(Exporter); +our @EXPORT = qw(init next); + +my $topology = { + hosts => { + "6c8814709208" => { + "port" => 8 + }, + "3431c4778157" => { + "port" => 24 + } + } +}; + +sub init { + my $class = shift; + my $sock = shift; + my $self = { "count" => 0, "pcap" => "args-http.pcap", + "sock" => $sock, "version" => main::OFP_V_1_0() }; + + bless($self, $class); + + main::ofp_hello($self); + + return ($self); +} + +sub next { + my $class = shift; + my $self = shift; + my $src; + + $self->{count}++; + + $src = $topology->{hosts}->{$self->{eh}->{src_mac}}; + if ($src) { + $self->{port} = $src->{port}; + } + + main::ofp_packet_in($self, $self->{data}); +} + +1; diff --git a/regress/usr.sbin/switchd/args-icmp.pcap b/regress/usr.sbin/switchd/args-icmp.pcap new file mode 100644 index 0000000000000000000000000000000000000000..6da899c3554d8108f99b6b8be3a26c82ae8b948e GIT binary patch literal 708 zcmca|c+)~A1{MYwxWLZ9zzF2rjq3{+-pb361Z0CSgH~2~*`9#!OAoE(u8~ zX&G5Lc?Cr!WffI5bq!4|Z5>@beFH-yV-r&|bC8YCw;^nV*afi{Vk5{I7L2c!gKPuY z%D|99k&X9&HXhl7uo2UbO>aSdT(A@2#~D39KQco7C=BvrwaoU}ZvveT +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +package args_icmp; + +use strict; +use warnings; +use base qw(Exporter); +our @EXPORT = qw(init next); + +sub init { + my $class = shift; + my $sock = shift; + my $self = { "count" => 0, "pcap" => "args-icmp.pcap", + "sock" => $sock, "version" => main::OFP_V_1_0() }; + + bless($self, $class); + + main::ofp_hello($self); + + return ($self); +} + +sub next { + my $class = shift; + my $self = shift; + + $self->{count}++; + $self->{port} = $self->{count} % 2; + + main::ofp_packet_in($self, $self->{data}); +} + +1; -- 2.20.1