Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
facd15a2
authored
Jul 24, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing flow port to get directly from database
parent
694e982b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
networkdriver.py
+5
-5
No files found.
networkdriver.py
View file @
facd15a2
...
...
@@ -2,7 +2,6 @@
import
subprocess
import
logging
import
re
def
ovs_command_execute
(
command
):
...
...
@@ -55,7 +54,7 @@ def port_create(network):
ovs_command_execute
(
cmd_list
)
# Getting network FlowPortNumber
port_number
=
get_
port_number
(
network
)
port_number
=
get_
fport_for_network
(
network
)
# Set Flow rules to avoid mac or IP spoofing
# Set flow rule 1 (dhcp server ban)
...
...
@@ -108,9 +107,10 @@ def port_delete(network):
ovs_command_execute
(
cmd_list
)
def
get_
port_number
(
network
):
def
get_
fport_for_network
(
network
):
'''Returns the OpenFlow port number for a given network
cmd: ovs-vsctl get Interface vm-88 ofport
'''
output
=
subprocess
.
check_output
(
[
'sudo'
,
'ovs-
ofctl'
,
'dump-ports'
,
network
.
bridge
,
network
.
name
])
return
re
.
search
(
'port *([0-9]+)'
,
output
)
.
group
(
1
)
[
'sudo'
,
'ovs-
vsctl'
,
'get'
,
'Interface'
,
network
.
name
,
'ofport'
])
return
output
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment