Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kube OVN
Commits
ad1eca07
Unverified
Commit
ad1eca07
authored
6 years ago
by
Oilbeater
Committed by
GitHub
6 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #20 from alauda/feat/merge-nbctl
feat: merge ovn-nbctl request
parents
5d54d8cb
3c617451
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/ovs/ovn-nbctl.go
+4
-10
pkg/ovs/ovn-nbctl.go
with
4 additions
and
10 deletions
+4
-10
pkg/ovs/ovn-nbctl.go
+
4
-
10
View file @
ad1eca07
...
...
@@ -73,20 +73,14 @@ func (c Client) CreatePort(ls, port, ip, mac string) (*nic, error) {
mac
=
address
[
0
]
}
}
cidr
,
err
:=
c
.
ovnNbCommand
(
"get"
,
"logical_switch"
,
ls
,
"other_config:subnet"
)
output
,
err
:=
c
.
ovnNbCommand
(
"get"
,
"logical_switch"
,
ls
,
"other_config:subnet"
,
"other_config:gateway"
)
if
err
!=
nil
{
klog
.
Errorf
(
"get switch %s failed %v"
,
ls
,
err
)
return
nil
,
err
}
mask
:=
strings
.
Split
(
cidr
,
"/"
)[
1
]
gw
,
err
:=
c
.
ovnNbCommand
(
"get"
,
"logical_switch"
,
ls
,
"other_config:gateway"
)
if
err
!=
nil
{
klog
.
Errorf
(
"get switch %s failed %v"
,
ls
,
err
)
return
nil
,
err
}
return
&
nic
{
IpAddress
:
fmt
.
Sprintf
(
"%s/%s"
,
ip
,
mask
),
MacAddress
:
mac
,
CIDR
:
cidr
,
Gateway
:
gw
},
nil
subnet
,
gw
:=
strings
.
Trim
(
strings
.
Split
(
output
,
"
\n
"
)[
0
],
"
\"
"
),
strings
.
Trim
(
strings
.
Split
(
output
,
"
\n
"
)[
1
],
"
\"
"
)
mask
:=
strings
.
Split
(
subnet
,
"/"
)[
1
]
return
&
nic
{
IpAddress
:
fmt
.
Sprintf
(
"%s/%s"
,
ip
,
mask
),
MacAddress
:
mac
,
CIDR
:
subnet
,
Gateway
:
gw
},
nil
}
type
nic
struct
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help