-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchs3.h
More file actions
70 lines (49 loc) · 2.17 KB
/
switchs3.h
File metadata and controls
70 lines (49 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _SWITCHS3_H_
#define _SWITCHS3_H_
#include <string>
//#include "openflow-default.hh"
#include "flow.hh"
#include "ofp-msg-event.hh"
#include "flowmod.hh"
#include "datapath-join.hh"
#include "../../../oflib/ofl-actions.h"
#include "../../../oflib/ofl-messages.h"
#include "switch13.h"
#include "switchs2.h"
namespace pfswitch13{
using namespace vigil;
class SwitchS3:public Switch13{
public:
SwitchS3(const vigil::datapathid dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
SwitchS3(const unsigned dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
SwitchS3(const uint64_t dpid,const std::string &name,
const SwitchData &data):Switch13(dpid,name,data){}
virtual void configure(unsigned _tnum=0,enum of_tmod_cmd cmd=OFTM_ADD){
tnum=_tnum;
//std::cerr<<self.to_string()<<"\n";
Actions *acts=new Actions();
if(data.as=="vlan_id") acts->CreatePopVlan();
else acts->CreatePopVlan();
acts->CreateOutput(data.out_port);
Instruction *inst=new Instruction();
inst->CreateApply(acts);
FlowMod *mod = new FlowMod(0x00ULL,0x00ULL,tnum,
toFlowCmd(cmd), //OFPFC_ADD
OFP_FLOW_PERMANENT,
OFP_FLOW_PERMANENT,
OFP_DEFAULT_PRIORITY,
0,
OFPP_ANY,OFPG_ANY,ofd_flow_mod_flags());
mod->AddMatch(&self.match);
mod->AddInstructions(inst);
nox::send_openflow_msg(dpid,(struct ofl_msg_header *)&mod->fm_msg,0,true);
//delete inst; delete acts;
}
virtual void switchWeights(unsigned*,enum of_tmod_cmd=OFTM_MODIFY){
// nothing to do
}
}; // class SwitchS3
}; // namespace pfswitch13
#endif // _SWITCHS3_H_