Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 61 lines (48 sloc) 1.727 kb
e70b98e @robhoes Initial Openvswitch module with high-level functions
authored
1 open Openvswitch
2
3 let _ =
4 (* set_socket_unix "/var/run/openvswitch/db.sock" *)
5 set_socket_tcp "10.80.224.133" 6632;
f99a873 @robhoes Bridge/Port/Interface creation, destruction, and get_all
authored
6
7 let show_interface uuid =
8 let i = Interface.get uuid in
9 Printf.printf "\t\t%s, %s\n" i.Interface.name i.Interface.mac
10 in
11 let show_port uuid =
12 let p = Port.get uuid in
13 Printf.printf "\t%s, %s\n" p.Port.name p.Port.mac;
14 List.iter show_interface p.Port.interfaces
15 in
7eb2af7 @robhoes Extend Openvswitch module and test program
authored
16 let show_bridge uuid =
310d429 @robhoes add test program creating a GRE tunnel
authored
17 let b = Bridge.get ~uuid () in
5625bc0 @robhoes Added Bridge.destroy
authored
18 Printf.printf "%s, %s\n" b.Bridge.name uuid;
7eb2af7 @robhoes Extend Openvswitch module and test program
authored
19 List.iter show_port b.Bridge.ports
20 in
5625bc0 @robhoes Added Bridge.destroy
authored
21 print_endline "Current list of bridges";
7eb2af7 @robhoes Extend Openvswitch module and test program
authored
22 let bridges = Bridge.get_all () in
91f6904 @robhoes Create bridge (though not yet referenced from the Open_vSwitch table
authored
23 List.iter show_bridge bridges;
5625bc0 @robhoes Added Bridge.destroy
authored
24 print_endline "====";
e70b98e @robhoes Initial Openvswitch module with high-level functions
authored
25
f99a873 @robhoes Bridge/Port/Interface creation, destruction, and get_all
authored
26 let bridge = Bridge.create "testtest" in
90fcce0 @robhoes Interface creation and destruction
authored
27 print_endline ("Created bridge " ^ bridge);
5625bc0 @robhoes Added Bridge.destroy
authored
28
f99a873 @robhoes Bridge/Port/Interface creation, destruction, and get_all
authored
29 let port = Port.create ~bridge "newport" in
30 print_endline ("Created port: " ^ port);
31
32 let interface = Interface.create ~port ~ty:(Interface.Gre("10.80.3.142", [])) "newif" in
33 print_endline ("Created interface: " ^ interface);
34
91166f1 @robhoes Interface.update
authored
35 let interface_rec = Interface.get interface in
310d429 @robhoes add test program creating a GRE tunnel
authored
36 let _ = Interface.update interface {interface_rec with Interface.name = "newerif"} in
91166f1 @robhoes Interface.update
authored
37 print_endline ("Modified interface: " ^ interface);
38
5625bc0 @robhoes Added Bridge.destroy
authored
39 let bridges = Bridge.get_all () in
40 List.iter show_bridge bridges;
41 print_endline "====";
42
90fcce0 @robhoes Interface creation and destruction
authored
43 let n = Bridge.destroy bridge in
5625bc0 @robhoes Added Bridge.destroy
authored
44 print_endline ("Deleted " ^ (string_of_int n) ^ " bridge ");
45
46 let bridges = Bridge.get_all () in
47 List.iter show_bridge bridges;
48 print_endline "====";
e919641 @robhoes Create interface
authored
49
f99a873 @robhoes Bridge/Port/Interface creation, destruction, and get_all
authored
50 print_endline "All ports";
51 let ports = Port.get_all () in
52 List.iter show_port ports;
53 print_endline "====";
54
55 print_endline "All interfaces";
56 let interfaces = Interface.get_all () in
57 List.iter show_interface interfaces;
58 print_endline "====";
36f9492 Add created bridge to main table
root authored
59 ()
477257c @robhoes Add delete operation
authored
60
Something went wrong with that request. Please try again.