Skip to content

Commit

Permalink
feat: ipv6 support improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud User committed Jun 20, 2024
1 parent 626bb43 commit 26b4069
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ncm-network/src/main/perl/nmstate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,16 @@ sub generate_nmstate_config
$ip_list->{ip} = $ip->addr;
$ip_list->{'prefix-length'} = $ip->masklen;
push @$ips, $ip_list;
foreach my $ipv6_sec ($iface->{ipv6addr_secondaries}) {
# $ip = NetAddr::IP->new($ipv6_sec);
print $ipv6_sec;
# my $ip_tmp = {};
# $ip_tmp->{ip} = $ip->addr;
# $ip_tmp->{'prefix-length'} = $ip->masklen;
# print $ip_tmp->{ip};
# print $ip_list->{'prefix-length'};
# push @$ips, $ip_tmp;

my @ipv6_secondaries = $iface->{ipv6addr_secondaries};
foreach my $ipv6_sec ( @ipv6_secondaries ) {
# label ipv6
my $ip = NetAddr::IP->new($ipv6_sec);
my $ip_tmp = {};
$ip_tmp->{ip} = $ip->{addr};
$ip_tmp->{'prefix-length'} = $ipv6_sec;
# push @ips, $ip_tmp;
print $ip_tmp;
}
$ifaceconfig->{ipv6}->{address} = $ips;
$ifaceconfig->{ipv6}->{enabled} = $YTRUE;
Expand Down
3 changes: 3 additions & 0 deletions ncm-network/src/test/perl/nmstate_ipv6.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use Test::More;
use Test::Quattor qw(ipv6);
use Test::MockModule;
use Readonly;
use Test::Output;

use NCM::Component::nmstate;
my $mock = Test::MockModule->new('NCM::Component::nmstate');
Expand Down Expand Up @@ -56,6 +57,8 @@ Test the C<Configure> method of the component for ipv6 configuration.
=cut

$cmp->Configure($cfg);

is($cmp->Configure($cfg), 1, "Component runs correctly with a test profile");

my $eth0yml = get_file_contents("/etc/nmstate/eth0.yml");
Expand Down

0 comments on commit 26b4069

Please sign in to comment.