Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uplink addresses for OVN network #1512

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/incus/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,12 @@ func (c *cmdNetworkInfo) Run(cmd *cobra.Command, args []string) error {
if client.HasExtension("network_state_ovn_lr") {
fmt.Printf(" %s: %s\n", i18n.G("Logical router"), state.OVN.LogicalRouter)
}
if state.OVN.UplinkIPv4 != "" {
fmt.Printf(" %s: %s\n", i18n.G("UplinkIPv4"), state.OVN.UplinkIPv4)
}
if state.OVN.UplinkIPv6 != "" {
fmt.Printf(" %s: %s\n", i18n.G("UplinkIPv6"), state.OVN.UplinkIPv6)
}
}

return nil
Expand Down
10 changes: 10 additions & 0 deletions doc/rest-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,16 @@ definitions:
example: incus-net1-lr
type: string
x-go-name: LogicalRouter
uplink_ipv4:
description: OVN network uplink ipv4 address
example: 10.0.0.1
type: string
x-go-name: UplinkIPv4
uplink_ipv6:
description: OVN network uplink ipv6 address
example: 2001:0000:130F:0000:0000:09C0:876A:130B.
type: string
x-go-name: UplinkIPv6
type: object
x-go-package: github.com/lxc/incus/v6/shared/api
NetworkStateVLAN:
Expand Down
13 changes: 13 additions & 0 deletions internal/server/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ func (n *ovn) State() (*api.NetworkState, error) {
mtu = 1500
}

var uplinkIPv4 string
var uplinkIPv6 string

if n.config[ovnVolatileUplinkIPv4] != "" {
uplinkIPv4 = n.config[ovnVolatileUplinkIPv4];
}

if n.config[ovnVolatileUplinkIPv6] != "" {
uplinkIPv6 = n.config[ovnVolatileUplinkIPv6];
}

return &api.NetworkState{
Addresses: addresses,
Counters: api.NetworkStateCounters{},
Expand All @@ -185,6 +196,8 @@ func (n *ovn) State() (*api.NetworkState, error) {
OVN: &api.NetworkStateOVN{
Chassis: chassis,
LogicalRouter: string(n.getRouterName()),
UplinkIPv4: uplinkIPv4,
UplinkIPv6: uplinkIPv6,
},
}, nil
}
Expand Down
Loading