-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/iscsi: utilize network namespaces in iSCSI tests
Network namespaces are used to assure that kernel is not routing packets within host stack, but they go through veth interfaces. This patch serves as a base for future VPP test changes, where namespaces are used as well. Change-Id: Ic7b82b0a0837bca2e16774fde244348a691fe056 Signed-off-by: Tomasz Zawadzki <[email protected]> Reviewed-on: https://review.gerrithub.io/405641 Reviewed-by: Jim Harris <[email protected]> Reviewed-by: Daniel Verkamp <[email protected]> Tested-by: SPDK Automated Test System <[email protected]>
- Loading branch information
1 parent
adfa9f6
commit 5bafc24
Showing
9 changed files
with
60 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,43 @@ | ||
# Network configuration | ||
TARGET_INTERFACE="spdk_tgt_int" | ||
INITIATOR_INTERFACE="spdk_init_int" | ||
TARGET_NAMESPACE="spdk_iscsi_ns" | ||
TARGET_NS_CMD="ip netns exec $TARGET_NAMESPACE" | ||
|
||
# iSCSI target configuration | ||
TARGET_IP=10.0.0.1 | ||
INITIATOR_IP=10.0.0.2 | ||
ISCSI_PORT=3260 | ||
NETMASK=$INITIATOR_IP/30 | ||
NETMASK=$INITIATOR_IP/32 | ||
INITIATOR_TAG=2 | ||
INITIATOR_NAME=ANY | ||
PORTAL_TAG=1 | ||
ISCSI_APP="./app/iscsi_tgt/iscsi_tgt -i 0" | ||
ISCSI_APP="$TARGET_NS_CMD ./app/iscsi_tgt/iscsi_tgt -i 0" | ||
ISCSI_TEST_CORE_MASK=0xFF | ||
|
||
function create_veth_interfaces() { | ||
ip netns del $TARGET_NAMESPACE || true | ||
ip link delete $INITIATOR_INTERFACE || true | ||
|
||
# Create veth (Virtual ethernet) interface pair | ||
ip link add $INITIATOR_INTERFACE type veth peer name $TARGET_INTERFACE | ||
ip addr add $INITIATOR_IP/24 dev $INITIATOR_INTERFACE | ||
ip link set $INITIATOR_INTERFACE up | ||
|
||
ip addr add $TARGET_IP/24 dev $TARGET_INTERFACE | ||
ip link set $TARGET_INTERFACE up | ||
# Create and add interface for target to network namespace | ||
ip netns add $TARGET_NAMESPACE | ||
ip link set $TARGET_INTERFACE netns $TARGET_NAMESPACE | ||
|
||
$TARGET_NS_CMD ip link set lo up | ||
$TARGET_NS_CMD ip addr add $TARGET_IP/24 dev $TARGET_INTERFACE | ||
$TARGET_NS_CMD ip link set $TARGET_INTERFACE up | ||
|
||
trap "cleanup_veth_interfaces; exit 1" SIGINT SIGTERM EXIT | ||
} | ||
|
||
function cleanup_veth_interfaces() { | ||
# Cleanup veth interfaces | ||
# Cleanup veth interfaces and network namespace | ||
# Note: removing one veth, removes the pair | ||
ip link delete $INITIATOR_INTERFACE | ||
ip netns del $TARGET_NAMESPACE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters