Skip to content

[DO NOT MERGE] skeleton nextgen network module #1586

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions ncm-network/src/main/pan/components/network/config-ng.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ${license-info}
# ${developer-info}
# ${author-info}

unique template components/network/config-ng;

include 'components/network/config';

prefix "/software/components/network";
"ncm-module" = "network_ng";

# Add dependency that can't be added to rpm directly
prefix '/software/packages';
'NetworkManager-initscripts-updown' = dict();
'NetworkManager-config-server' = dict();
12 changes: 12 additions & 0 deletions ncm-network/src/main/perl/network_ng.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#${PMpre} NCM::Component::network_ng${PMpost}

use parent qw (NCM::Component::network);

sub disable_networkmanager
{
my ($self, $allow) = @_;
# do nothing
};


1;
28 changes: 28 additions & 0 deletions ncm-network/src/test/perl/ng_simple.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use strict;
use warnings;

BEGIN {
*CORE::GLOBAL::sleep = sub {};
}

use Test::More;
use Test::Quattor qw(ng_simple);
use Test::MockModule;

use NCM::Component::network_ng;
my $mock = Test::MockModule->new('NCM::Component::network_ng');

my $cfg = get_config_for_profile('ng_simple');
my $cmp = NCM::Component::network_ng->new('network');


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

# From here, test custom methods
command_history_reset();
$cmp->disable_networkmanager(1);
# check there a executed commands that match NetworkManager
ok(command_history_ok(undef, ['NetworkManager']));


done_testing();
6 changes: 6 additions & 0 deletions ncm-network/src/test/resources/ng_simple.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object template ng_simple;

include 'simple_base_profile';
# the next include is mainly to the profile, it is not used in the tests
# (unless the component gets specific schema things)
include 'components/network/config-ng';