Project

General

Profile

Actions

Feature #14122

open

Want link-state property for simnet links

Added by Ryan Goodfellow 4 months ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Category:
-
Start date:
2021-09-29
Due date:
% Done:

0%

Estimated time:
1.00 h
Difficulty:
Bite-size
Tags:
simnet
Gerrit CR:

Description

Simnet links are often used to create networked systems on a local machine for testing and evaluation. A useful capability to have when testing a distributed or networked system, is to be able to take links up and down and see how the overall system responds.

Actions #1

Updated by Electric Monk 4 months ago

  • Gerrit CR set to 1735
Actions #2

Updated by Ryan Goodfellow 4 months ago

The following is an example of using this capability

ry@masaka:~$ pfexec dladm create-simnet sim0                            
ry@masaka:~$ pfexec dladm show-link sim0                                
LINK        CLASS     MTU    STATE    BRIDGE     OVER                   
sim0        simnet    1500   up       --         --                     
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate sim0              
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
sim0         _linkstate      rw   up             --             --      
ry@masaka:~$ pfexec dladm set-linkprop -p _linkstate=down sim0          
ry@masaka:~$ pfexec dladm show-link sim0                                
LINK        CLASS     MTU    STATE    BRIDGE     OVER                   
sim0        simnet    1500   down     --         --                     
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate sim0              
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
sim0         _linkstate      rw   down           --             --      
Actions #3

Updated by Ryan Goodfellow 4 months ago

I've tested this as standalone simnet links as well as vnics attached to simnet links. In the latter case, when a simnet device that underpins a vnic has its state toggled, the state of the upstream vnic also changes.

Actions #4

Updated by Ryan Goodfellow 4 months ago

An interesting thing to note here is setting the link state to down on a simnet device prevents transmission but receiving still works. While at first glance this may seem undesirable, I think this actually a good thing as this can be used to represent failure modes that can happen in the real world. For example, an LC type optical link where one of the fibers has been impaired but not the other.

Actions #5

Updated by Ryan Goodfellow 4 months ago

Updated testing notes after for etherstub

ry@masaka:~$ pfexec dladm create-etherstub es0
ry@masaka:~$ pfexec dladm show-link es0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
es0         etherstub 9000   up       --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate es0
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
es0          _linkstate      rw   up             unknown        -- 
ry@masaka:~$ pfexec dladm set-linkprop -p _linkstate=unknown es0
ry@masaka:~$ pfexec dladm show-link es0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
es0         etherstub 9000   unknown  --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate es0
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
es0          _linkstate      rw   unknown        unknown        -- 
ry@masaka:~$ pfexec dladm set-linkprop -p _linkstate=down es0
ry@masaka:~$ pfexec dladm show-link es0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
es0         etherstub 9000   down     --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate es0
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
es0          _linkstate      rw   down           unknown        -- 
Actions #6

Updated by Ryan Goodfellow 4 months ago

Updated testing notes for simnet with default value defined and unknown value accepted

ry@masaka:~$ pfexec dladm create-simnet sim0
ry@masaka:~$ pfexec dladm show-link sim0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
sim0        simnet    1500   up       --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate sim0 
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
sim0         _linkstate      rw   up             unknown        -- 
ry@masaka:~$ pfexec dladm set-linkprop -p _linkstate=down sim0
ry@masaka:~$ pfexec dladm show-link sim0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
sim0        simnet    1500   down     --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate sim0
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
sim0         _linkstate      rw   down           unknown        -- 
ry@masaka:~$ pfexec dladm set-linkprop -p _linkstate=unknown sim0
ry@masaka:~$ pfexec dladm show-link sim0
LINK        CLASS     MTU    STATE    BRIDGE     OVER
sim0        simnet    1500   unknown  --         --
ry@masaka:~$ pfexec dladm show-linkprop -p _linkstate sim0
LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
sim0         _linkstate      rw   unknown        unknown        -- 
Actions

Also available in: Atom PDF