Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
8753bf09
Commit
8753bf09
authored
Mar 26, 2018
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes and updates for wire/card/port changes.
parent
1019baf9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
utils/addspecialiface.in
utils/addspecialiface.in
+20
-13
No files found.
utils/addspecialiface.in
View file @
8753bf09
#!/usr/bin/perl -w
#
# Copyright (c) 2003-201
7
University of Utah and the Flux Group.
# Copyright (c) 2003-201
8
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -214,6 +214,7 @@ my $nodecard;
my
$switchid
;
my
$switchcard
;
my
$switchport
;
my
$switchiface
;
if
(
!
$impotent
&&
$node
->
IsReserved
()
&&
$node
->
erole
()
eq
"
sharedhost
"
&&
$notrunk
&&
!
$force
)
{
...
...
@@ -234,13 +235,19 @@ if ($iface_id =~ /^[^\d]*(\d*)$/) {
else
{
fatal
("
iface_id is not in the proper format
");
}
if
(
Interface
->
Lookup
(
$node
,
$nodecard
))
{
fatal
("
Node already has an interface with card=
$nodecard
");
if
(
Interface
->
LookupByIface
(
$node
,
$iface_id
))
{
fatal
("
Node already has an interface with iface=
$iface_id
");
}
# But also need to look for any thing using this card,port;
my
$wire
=
Interface::
Wire
->
LookupAny
(
$node
,
$nodecard
,
1
);
if
(
defined
(
$wire
))
{
fatal
("
Node
$node_id
already has a wire:
$wire
");
}
if
(
$switchinfo
=~
/^([-\w]+),(\d+),(\d+)$/
)
{
$switchid
=
$
1
;
$switchcard
=
$
2
;
$switchport
=
$
3
;
$switchiface
=
$switchcard
.
"
/
"
.
$switchport
;
}
else
{
fatal
("
Invalid switch info
");
...
...
@@ -249,12 +256,12 @@ my $switch = Node->Lookup($switchid);
if
(
!
defined
(
$switch
))
{
fatal
("
Switch
$switchid
does not exist
");
}
if
(
Interface
->
Lookup
(
$node
,
$switchcard
,
$switchport
))
{
if
(
Interface
->
Lookup
ByIface
(
$node
,
$switchiface
))
{
fatal
("
Switch
$switchid
already has an interface with
"
.
"
card=
$switchcard
,port=
$switchport
");
"
iface=
$switchiface
");
}
# But also need to look for any thing using this port;
my
$wire
=
Interface::
Wire
->
LookupAny
(
$switchid
,
$switchcard
,
$switchport
);
# But also need to look for any thing using this
card,
port;
$wire
=
Interface::
Wire
->
LookupAny
(
$switchid
,
$switchcard
,
$switchport
);
if
(
defined
(
$wire
))
{
fatal
("
Switch
$switchid
already using this interface:
$wire
");
}
...
...
@@ -273,7 +280,7 @@ if (!defined($type)) {
my
$ifaceargs1
=
{
"
card
"
=>
$switchcard
,
"
port
"
=>
$switchport
,
"
iface
"
=>
$switch
card
.
"
/
"
.
$switchport
,
"
iface
"
=>
$switch
iface
,
"
role
"
=>
TBDB_IFACEROLE_OTHER
(),
"
type
"
=>
$type
->
type
(),
"
max_speed
"
=>
$type
->
max_speed
(),
...
...
@@ -304,13 +311,13 @@ if (!$impotent) {
}
if
(
!
$impotent
)
{
my
$wireargs
=
{
"
card1
"
=>
$
switch
card
,
"
port1
"
=>
$switchport
,
"
card2
"
=>
$
node
card
,
"
port2
"
=>
1
,
"
card1
"
=>
$
node
card
,
"
port1
"
=>
1
,
"
card2
"
=>
$
switch
card
,
"
port2
"
=>
$switchport
,
};
print
"
Creating wire for
$interface1
,
$interface2
:
\n
";
$wire
=
Interface::
Wire
->
Create
(
$interface1
,
$interface2
,
'
Node
',
{}
)
$wire
=
Interface::
Wire
->
Create
(
$interface1
,
$interface2
,
'
Node
',
$wireargs
)
or
fatal
("
Could not create wire
");
}
if
(
!
$impotent
&&
...
...
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