Merge "[ONOS-7280] Refactoring Jenkins file"
diff --git a/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
index 037b6d4..6f67b0d 100644
--- a/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
@@ -303,7 +303,6 @@
xLabel <- xlab( "Scale" )
yLabel <- ylab( "Latency (ms)" )
fillLabel <- labs( fill="Type" )
-title <- ggtitle( chartTitle )
imageWidth <- 15
imageHeight <- 10
imageDPI <- 200
@@ -313,7 +312,12 @@
legend.position="bottom",
legend.text=element_text( size=22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = chartTitle, subtitle = subtitle )
colors <- scale_fill_manual( values=c( "#F77670",
"#619DFA",
diff --git a/TestON/JenkinsFile/scripts/SCPFLineGraph.R b/TestON/JenkinsFile/scripts/SCPFLineGraph.R
index d063d0a..8c59c0d 100644
--- a/TestON/JenkinsFile/scripts/SCPFLineGraph.R
+++ b/TestON/JenkinsFile/scripts/SCPFLineGraph.R
@@ -141,6 +141,10 @@
# Create lists c() and organize data into their corresponding list.
print( "Combine data retrieved from databases into a list." )
+buildNums <- fileData$build
+fileData$build <- c()
+print( fileData )
+
if ( ncol( fileData ) > 1 ){
for ( i in 2:ncol( fileData ) ){
fileData[ i ] <- fileData[ i - 1 ] + fileData[ i ]
@@ -163,6 +167,7 @@
# Format data frame so that the data is in the same order as it appeared in the file.
dataFrame$Legend <- as.character( dataFrame$Legend )
dataFrame$Legend <- factor( dataFrame$Legend, levels=unique( dataFrame$Legend ) )
+dataFrame$build <- buildNums
# Adding a temporary iterative list to the dataFrame so that there are no gaps in-between date numbers.
dataFrame$iterative <- rev( seq( 1, nrow( fileData ), by = 1 ) )
@@ -205,9 +210,14 @@
limitExpansion <- expand_limits( y = 0 )
+tickLength <- 3
+breaks <- seq( max( dataFrame$iterative ) %% tickLength, max( dataFrame$iterative ), by = tickLength )
+breaks <- breaks[ which( breaks != 0 ) ]
+
maxYDisplay <- max( dataFrame$Values ) * 1.05
yBreaks <- ceiling( max( dataFrame$Values ) / 10 )
yScaleConfig <- scale_y_continuous( breaks = seq( 0, maxYDisplay, by = yBreaks ) )
+xScaleConfig <- scale_x_continuous( breaks = breaks, label = rev( dataFrame$build )[ breaks ] )
# ------------------------------
# Fundamental Variables Assigned
@@ -224,14 +234,18 @@
imageDPI <- 200
# Set other graph configurations here.
-theme <- theme( axis.text.x = element_blank(),
- axis.ticks.x = element_blank(),
+theme <- theme( axis.text.x = element_text( angle = 0, size = 13 ),
plot.title = element_text( size = 32, face='bold', hjust = 0.5 ),
legend.position = "bottom",
legend.text = element_text( size=22 ),
legend.title = element_blank(),
legend.key.size = unit( 1.5, 'lines' ),
- legend.direction = 'horizontal' )
+ legend.direction = 'horizontal',
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = title, subtitle = subtitle )
# Colors used for the lines.
# Note: graphs that have X lines will use the first X colors in this list.
@@ -243,10 +257,10 @@
"#E500FF") ) # purple (not used)
wrapLegend <- guides( color = guide_legend( nrow = 2, byrow = TRUE ) )
-title <- ggtitle( title )
fundamentalGraphData <- mainPlot +
limitExpansion +
+ xScaleConfig +
yScaleConfig +
xLabel +
yLabel +
diff --git a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
index d90c53e..b86ef67 100644
--- a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
+++ b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
@@ -263,7 +263,10 @@
legend.position = "bottom",
legend.text = element_text( size = 22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
barGraphFormat <- geom_bar( stat = "identity",
width = barWidth )
@@ -286,8 +289,8 @@
xScaleConfig <- scale_x_continuous( breaks = postDataFrame$iterative,
label = postDataFrame$date )
-title <- ggtitle( postChartTitle )
+title <- labs( title = postChartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
@@ -358,7 +361,8 @@
xScaleConfig <- scale_x_continuous( breaks = delDataFrame$iterative,
label = delDataFrame$date )
-title <- ggtitle( delChartTitle )
+
+title <- labs( title = delChartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/SCPFcbench.R b/TestON/JenkinsFile/scripts/SCPFcbench.R
index 0a28024..9d1972a 100644
--- a/TestON/JenkinsFile/scripts/SCPFcbench.R
+++ b/TestON/JenkinsFile/scripts/SCPFcbench.R
@@ -204,9 +204,12 @@
theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face = 'bold' ),
legend.position = "bottom",
legend.text = element_text( size = 18, face = "bold" ),
- legend.title = element_blank() )
+ legend.title = element_blank(),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
-title <- ggtitle( chartTitle )
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = chartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
index 3d3a95e..ffb91a9 100644
--- a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
+++ b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
@@ -258,8 +258,12 @@
theme <- theme( plot.title = element_text( hjust = 0.5,
size = 32,
- face = 'bold' ) )
-title <- ggtitle( chartTitle )
+ face = 'bold' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = chartTitle, subtitle = subtitle )
# Store plot configurations as 1 variable
fundamentalGraphData <- mainPlot +
diff --git a/TestON/JenkinsFile/scripts/SCPFhostLat.R b/TestON/JenkinsFile/scripts/SCPFhostLat.R
index 90781a3..b291551 100644
--- a/TestON/JenkinsFile/scripts/SCPFhostLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFhostLat.R
@@ -193,8 +193,12 @@
xLabel <- xlab( "Scale" )
yLabel <- ylab( "Latency (ms)" )
fillLabel <- labs( fill="Type" )
-theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face ='bold' ) )
-title <- ggtitle( chartTitle )
+theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face ='bold' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = chartTitle, subtitle = subtitle )
errorBarColor <- rgb( 140, 140, 140, maxColorValue = 255 )
imageWidth <- 15
imageHeight <- 10
diff --git a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
index 0b168ba..e9a9dc4 100644
--- a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
+++ b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
@@ -251,7 +251,10 @@
theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face = 'bold' ),
legend.position = "bottom",
legend.text = element_text( size = 18, face = "bold" ),
- legend.title = element_blank() )
+ legend.title = element_blank(),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
values <- geom_text( aes( x = dataFrame$scale,
y = dataFrame$throughput + 0.03 * max( dataFrame$throughput ),
@@ -280,7 +283,7 @@
width = width,
fill = "#169EFF" )
-title <- ggtitle( chartTitle )
+title <- labs( title = chartTitle, subtitle = subtitle )
result <- fundamentalGraphData +
barGraphFormat +
diff --git a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
index 30f7bca..9a61592 100644
--- a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
@@ -202,7 +202,10 @@
legend.position = "bottom",
legend.text = element_text( size=22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
barColors <- scale_fill_manual( values=c( "#F77670",
"#619DFA" ) )
@@ -229,7 +232,7 @@
errorBarColor <- rgb( 140, 140, 140, maxColorValue=255 )
-title <- ggtitle( chartTitle )
+title <- labs( title = chartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
@@ -295,7 +298,7 @@
print( "Generating fundamental graph data for the stacked bar graph." )
-title <- ggtitle( chartTitle )
+title <- labs( title = chartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/SCPFportLat.R b/TestON/JenkinsFile/scripts/SCPFportLat.R
index 4637072..3398b0b 100644
--- a/TestON/JenkinsFile/scripts/SCPFportLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFportLat.R
@@ -250,7 +250,10 @@
legend.position="bottom",
legend.text=element_text( size=22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
colors <- scale_fill_manual( values=c( "#F77670",
"#619DFA",
@@ -274,7 +277,7 @@
print( "Generating fundamental graph data (Port Up Latency)." )
-title <- ggtitle( "Port Up Latency" )
+title <- labs( title = "Port Up Latency", subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
@@ -348,7 +351,7 @@
print( "Generating fundamental graph data (Port Down Latency)." )
-title <- ggtitle( "Port Down Latency" )
+title <- labs( title = "Port Down Latency", subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
index e69a383..f6da0d2 100644
--- a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
+++ b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
@@ -208,7 +208,10 @@
legend.position = "bottom",
legend.text = element_text( size=22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
values <- geom_text( aes( x = dataFrame$iterative,
y = sum + 0.02 * max( sum ),
@@ -220,7 +223,7 @@
wrapLegend <- guides( fill = guide_legend( nrow=2, byrow=TRUE ) )
-title <- ggtitle( chartTitle, "" )
+title <- labs( title = chartTitle, subtitle = subtitle )
# Store plot configurations as 1 variable
fundamentalGraphData <- mainPlot +
diff --git a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
index 21dd70f..045f5e7 100644
--- a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
+++ b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
@@ -223,13 +223,17 @@
legend.position = "bottom",
legend.text = element_text( size=22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
colors <- scale_fill_manual( values = c( "#F77670",
"#619DFA" ) )
wrapLegend <- guides( fill = guide_legend( nrow = 1, byrow = TRUE ) )
-title <- ggtitle( chartTitle )
+
+title <- labs( title = chartTitle, subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/SCPFswitchLat.R b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
index de506a3..3535a5a 100644
--- a/TestON/JenkinsFile/scripts/SCPFswitchLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
@@ -256,7 +256,10 @@
legend.position = "bottom",
legend.text = element_text( size = 22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
# ----------------------------
# Switch Up Generate Main Plot
@@ -276,7 +279,7 @@
print( "Generating fundamental graph data (Switch Up Latency)." )
-title <- ggtitle( "Switch Up Latency" )
+title <- labs( title = "Switch Up Latency", subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
@@ -352,7 +355,7 @@
"#619DFA", # Blue
"#18BA48" ) ) # Green
-title <- ggtitle( "Switch Down Latency" )
+title <- labs( title = "Switch Down Latency", subtitle = subtitle )
fundamentalGraphData <- mainPlot +
xScaleConfig +
diff --git a/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R b/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R
index 1938ceb..5671a38 100644
--- a/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R
+++ b/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R
@@ -268,9 +268,12 @@
legend.position = "bottom",
legend.text = element_text( size = 22 ),
legend.title = element_blank(),
- legend.key.size = unit( 1.5, 'lines' ) )
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
-title <- ggtitle( title )
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = title, subtitle = subtitle )
# Store plot configurations as 1 variable
fundamentalGraphData <- mainPlot +
diff --git a/TestON/JenkinsFile/scripts/testCategoryBuildStats.R b/TestON/JenkinsFile/scripts/testCategoryBuildStats.R
new file mode 100644
index 0000000..0b4d4b5
--- /dev/null
+++ b/TestON/JenkinsFile/scripts/testCategoryBuildStats.R
@@ -0,0 +1,321 @@
+# Copyright 2017 Open Networking Foundation (ONF)
+#
+# Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+# the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+# or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+#
+# TestON is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# TestON is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with TestON. If not, see <http://www.gnu.org/licenses/>.
+#
+# If you have any questions, or if you don't understand R,
+# please contact Jeremy Ronquillo: j_ronquillo@u.pacific.edu
+
+# **********************************************************
+# STEP 1: Data management.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 1: Data management." )
+print( "**********************************************************" )
+
+# Command line arguments are read. Args include the database credentials, test name, branch name, and the directory to output files.
+print( "Reading commmand-line args." )
+args <- commandArgs( trailingOnly=TRUE )
+
+databaseHost <- 1
+databasePort <- 2
+databaseUserID <- 3
+databasePassword <- 4
+testSuiteName <- 5
+branchName <- 6
+testsToInclude <- 7
+buildToShow <- 8
+displayStatus <- 9
+scaleOfPercent <- 10
+saveDirectory <- 11
+
+# ----------------
+# Import Libraries
+# ----------------
+
+print( "Importing libraries." )
+library( ggplot2 )
+library( reshape2 )
+library( RPostgreSQL )
+
+# -------------------
+# Check CLI Arguments
+# -------------------
+
+print( "Verifying CLI args." )
+
+if ( is.na( args[ saveDirectory ] ) ){
+
+ print( paste( "Usage: Rscript testCategoryTrend.R",
+ "<database-host>",
+ "<database-port>",
+ "<database-user-id>",
+ "<database-password>",
+ "<test-suite-name>",
+ "<branch-name>",
+ "<tests-to-include-(as-one-string)>",
+ "<build-to-show>",
+ "<pass/fail/plan>",
+ "<percent-scale>",
+ "<directory-to-save-graphs>",
+ sep=" " ) )
+
+ quit( status = 1 ) # basically exit(), but in R
+}
+
+# ------------------
+# SQL Initialization
+# ------------------
+
+print( "Initializing SQL" )
+
+con <- dbConnect( dbDriver( "PostgreSQL" ),
+ dbname = "onostest",
+ host = args[ databaseHost ],
+ port = strtoi( args[ databasePort ] ),
+ user = args[ databaseUserID ],
+ password = args[ databasePassword ] )
+
+# ---------------------
+# Test Case SQL Command
+# ---------------------
+print( "Generating Test Case SQL command." )
+
+tests <- "'"
+for ( test in as.list( strsplit( args[ testsToInclude ], "," )[[1]] ) ){
+ tests <- paste( tests, test, "','", sep="" )
+}
+tests <- substr( tests, 0, nchar( tests ) - 2 )
+
+fileBuildToShow <- args[ buildToShow ]
+operator <- "= "
+if ( args[ buildToShow ] == "latest" ){
+ operator <- ">= "
+ args[ buildToShow ] <- "1000"
+}
+
+command <- paste( "SELECT * ",
+ "FROM executed_test_tests a ",
+ "WHERE ( SELECT COUNT( * ) FROM executed_test_tests b ",
+ "WHERE b.branch='",
+ args[ branchName ],
+ "' AND b.actual_test_name IN (",
+ tests,
+ ") AND a.actual_test_name = b.actual_test_name AND a.date <= b.date AND b.build ", operator,
+ args[ buildToShow ],
+ " ) = ",
+ 1,
+ " AND a.branch='",
+ args[ branchName ],
+ "' AND a.actual_test_name IN (",
+ tests,
+ ") AND a.build ", operator,
+ args[ buildToShow ],
+ " ORDER BY a.actual_test_name DESC, a.date DESC",
+ sep="")
+
+print( "Sending SQL command:" )
+print( command )
+dbResult <- dbGetQuery( con, command )
+
+maxBuild <- max( dbResult[ 'build' ] )
+dbResult <- dbResult[ which( dbResult[,4]>=maxBuild ), ]
+
+# -------------------------------
+# Create Title and Graph Filename
+# -------------------------------
+
+print( "Creating title of graph." )
+
+titleDisplayStatus <- ""
+if ( args[ displayStatus ] == "fail" ){
+ titleDisplayStatus <- "Failed"
+} else if ( args[ displayStatus ] == "plan" ){
+ titleDisplayStatus <- "Executed"
+} else if ( args[ displayStatus ] == "pass" ){
+ titleDisplayStatus <- "Succeeded"
+} else {
+ print( paste( "[ERROR]: Invalid histogram display status: ", args[ displayStatus ], sep="" ) )
+ quit( status = 1 )
+}
+
+title <- paste( args[ testSuiteName ],
+ " Tests ",
+ titleDisplayStatus,
+ " - ",
+ args[ branchName ],
+ " \n Build #",
+ max( dbResult[ 'build' ] ),
+ sep="" )
+
+print( "Creating graph filename." )
+
+outputFile <- paste( args[ saveDirectory ],
+ args[ testSuiteName ],
+ "_",
+ args[ branchName ],
+ "_build-",
+ fileBuildToShow,
+ "_",
+ args[ scaleOfPercent ],
+ "-scaling",
+ "_",
+ args[ displayStatus ],
+ "_histogram.jpg",
+ sep="" )
+
+print( dbResult )
+
+# **********************************************************
+# STEP 2: Organize data.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 2: Organize Data." )
+print( "**********************************************************" )
+
+t <- subset( dbResult, select=c( "actual_test_name", "num_passed", "num_failed", "num_planned" ) )
+t$passed_percent <- t$num_passed / t$num_planned * 100
+t$failed_percent <- t$num_failed / t$num_planned * 100
+t$planned_percent <- ( t$num_passed + t$num_failed ) / t$num_planned * 100
+
+# --------------------
+# Construct Data Frame
+# --------------------
+
+dataFrame <- aggregate( t$passed_percent, by=list( Category=t$actual_test_name ), FUN=sum )
+if ( args[ displayStatus ] == "fail" ){
+ dataFrame <- aggregate( t$failed_percent, by=list( Category=t$actual_test_name ), FUN=sum )
+} else if ( args[ displayStatus ] == "plan" ){
+ dataFrame <- aggregate( t$planned_percent, by=list( Category=t$actual_test_name ), FUN=sum )
+}
+
+colnames( dataFrame ) <- c( "Test", paste( titleDisplayStatus, "%", sep="" ) )
+
+print( "Data Frame Results:" )
+print( dataFrame )
+
+# **********************************************************
+# STEP 3: Generate graphs.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 3: Generate Graph." )
+print( "**********************************************************" )
+
+# -------------------
+# Main Plot Generated
+# -------------------
+
+print( "Creating main plot." )
+# Create the primary plot here.
+# ggplot contains the following arguments:
+# - data: the data frame that the graph will be based off of
+# - aes: the asthetics of the graph which require:
+# - x: x-axis values (usually iterative, but it will become build # later)
+# - y: y-axis values (usually tests)
+# - color: the category of the colored lines (usually status of test)
+
+mainPlot <- ggplot( data = dataFrame, aes( dataFrame[ ,2 ] ) )
+
+# -------------------
+# Main Plot Formatted
+# -------------------
+
+print( "Formatting main plot." )
+
+# ------------------------------
+# Fundamental Variables Assigned
+# ------------------------------
+
+print( "Generating fundamental graph data." )
+
+theme_set( theme_grey( base_size = 26 ) ) # set the default text size of the graph.
+
+xScaleConfig <- scale_x_continuous( breaks = seq( 0, 100, by = 10 ) )
+yScaleConfig <- scale_y_continuous( breaks = seq( 0, nrow( dbResult ), by = 1 ), limits = c( 0, nrow( dbResult ) ) )
+
+xLabel <- xlab( paste( titleDisplayStatus, "%" ) )
+yLabel <- ylab( "Frequency" )
+
+imageWidth <- 15
+imageHeight <- 10
+imageDPI <- 200
+
+# Set other graph configurations here.
+theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face ='bold' ),
+ axis.text.x = element_text( angle = 0, size = 14 ),
+ legend.position = "bottom",
+ legend.text = element_text( size = 22 ),
+ legend.title = element_blank(),
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = title, subtitle = subtitle )
+
+# Store plot configurations as 1 variable
+fundamentalGraphData <- mainPlot +
+ xScaleConfig +
+ yScaleConfig +
+ xLabel +
+ yLabel +
+ theme +
+ title
+
+# ----------------------------
+# Generating Line Graph Format
+# ----------------------------
+
+print( "Generating line graph." )
+
+barColor <- "#00B208"
+if ( args[ displayStatus ] == "fail" ){
+ barColor <- "#E80000"
+} else if ( args[ displayStatus ] == "plan" ){
+ barColor <- "#00A5FF"
+}
+
+histogramFormat <- geom_histogram( col = "#000000",
+ fill = barColor,
+ breaks = seq( 0, 100, by = strtoi( args[ scaleOfPercent ] ) ),
+ lwd = 0.5 )
+
+result <- fundamentalGraphData +
+ histogramFormat
+
+# -----------------------
+# Exporting Graph to File
+# -----------------------
+
+print( paste( "Saving result graph to", outputFile ) )
+
+tryCatch( ggsave( outputFile,
+ width = imageWidth,
+ height = imageHeight,
+ dpi = imageDPI ),
+ error = function( e ){
+ print( "[ERROR] There was a problem saving the graph due to a graph formatting exception. Error dump:" )
+ print( e )
+ quit( status = 1 )
+ }
+ )
+
+print( paste( "[SUCCESS] Successfully wrote result graph out to", outputFile ) )
+quit( status = 0 )
diff --git a/TestON/JenkinsFile/scripts/testCategoryTrend.R b/TestON/JenkinsFile/scripts/testCategoryTrend.R
new file mode 100644
index 0000000..33664b0
--- /dev/null
+++ b/TestON/JenkinsFile/scripts/testCategoryTrend.R
@@ -0,0 +1,325 @@
+# Copyright 2017 Open Networking Foundation (ONF)
+#
+# Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+# the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+# or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+#
+# TestON is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# TestON is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with TestON. If not, see <http://www.gnu.org/licenses/>.
+#
+# If you have any questions, or if you don't understand R,
+# please contact Jeremy Ronquillo: j_ronquillo@u.pacific.edu
+
+pipelineMinValue = 1000
+
+# **********************************************************
+# STEP 1: Data management.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 1: Data management." )
+print( "**********************************************************" )
+
+# Command line arguments are read. Args include the database credentials, test name, branch name, and the directory to output files.
+print( "Reading commmand-line args." )
+args <- commandArgs( trailingOnly=TRUE )
+
+databaseHost <- 1
+databasePort <- 2
+databaseUserID <- 3
+databasePassword <- 4
+testSuiteName <- 5
+branchName <- 6
+testsToInclude <- 7
+buildsToShow <- 8
+saveDirectory <- 9
+
+# ----------------
+# Import Libraries
+# ----------------
+
+print( "Importing libraries." )
+library( ggplot2 )
+library( reshape2 )
+library( RPostgreSQL )
+
+# -------------------
+# Check CLI Arguments
+# -------------------
+
+print( "Verifying CLI args." )
+
+if ( is.na( args[ saveDirectory ] ) ){
+
+ print( paste( "Usage: Rscript testCategoryTrend.R",
+ "<database-host>",
+ "<database-port>",
+ "<database-user-id>",
+ "<database-password>",
+ "<test-suite-name>",
+ "<branch-name>",
+ "<tests-to-include-(as-one-string)>",
+ "<builds-to-show>",
+ "<directory-to-save-graphs>",
+ sep=" " ) )
+
+ quit( status = 1 ) # basically exit(), but in R
+}
+
+# -------------------------------
+# Create Title and Graph Filename
+# -------------------------------
+
+print( "Creating title of graph." )
+
+title <- paste( args[ testSuiteName ],
+ " Test Results Trend - ",
+ args[ branchName ],
+ " \n Results of Last ",
+ args[ buildsToShow ],
+ " Nightly Builds",
+ sep="" )
+
+print( "Creating graph filename." )
+
+outputFile <- paste( args[ saveDirectory ],
+ args[ testSuiteName ],
+ "_",
+ args[ branchName ],
+ "_overview.jpg",
+ sep="" )
+
+# ------------------
+# SQL Initialization
+# ------------------
+
+print( "Initializing SQL" )
+
+con <- dbConnect( dbDriver( "PostgreSQL" ),
+ dbname = "onostest",
+ host = args[ databaseHost ],
+ port = strtoi( args[ databasePort ] ),
+ user = args[ databaseUserID ],
+ password = args[ databasePassword ] )
+
+# ---------------------
+# Test Case SQL Command
+# ---------------------
+print( "Generating Test Case SQL command." )
+
+tests <- "'"
+for ( test in as.list( strsplit( args[ testsToInclude ], "," )[[1]] ) ){
+ tests <- paste( tests, test, "','", sep="" )
+}
+tests <- substr( tests, 0, nchar( tests ) - 2 )
+
+command <- paste( "SELECT * ",
+ "FROM executed_test_tests a ",
+ "WHERE ( SELECT COUNT( * ) FROM executed_test_tests b ",
+ "WHERE b.branch='",
+ args[ branchName ],
+ "' AND b.actual_test_name IN (",
+ tests,
+ ") AND a.actual_test_name = b.actual_test_name AND a.date <= b.date AND b.build >= ",
+ pipelineMinValue,
+ " ) <= ",
+ args[ buildsToShow ],
+ " AND a.branch='",
+ args[ branchName ],
+ "' AND a.actual_test_name IN (",
+ tests,
+ ") AND a.build >= ",
+ pipelineMinValue,
+ " ORDER BY a.actual_test_name DESC, a.date DESC",
+ sep="")
+
+print( "Sending SQL command:" )
+print( command )
+dbResult <- dbGetQuery( con, command )
+maxBuild <- max( dbResult[ 'build' ] ) - strtoi( args[ buildsToShow ] )
+dbResult <- dbResult[ which( dbResult[,4]>maxBuild ), ]
+print( dbResult )
+
+# **********************************************************
+# STEP 2: Organize data.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 2: Organize Data." )
+print( "**********************************************************" )
+
+t <- subset( dbResult, select=c( "actual_test_name", "build", "num_failed" ) )
+t$num_failed <- ceiling( t$num_failed / ( t$num_failed + 1 ) )
+t$num_planned <- 1
+
+fileData <- aggregate( t$num_failed, by=list( Category=t$build ), FUN=sum )
+colnames( fileData ) <- c( "build", "num_failed" )
+
+fileData$num_planned <- ( aggregate( t$num_planned, by=list( Category=t$build ), FUN=sum ) )$x
+fileData$num_passed <- fileData$num_planned - fileData$num_failed
+
+print(fileData)
+
+# --------------------
+# Construct Data Frame
+# --------------------
+#
+
+dataFrame <- melt( subset( fileData, select=c( "num_failed", "num_passed", "num_planned" ) ) )
+dataFrame$build <- fileData$build
+colnames( dataFrame ) <- c( "status", "results", "build" )
+
+dataFrame$num_failed <- fileData$num_failed
+dataFrame$num_passed <- fileData$num_passed
+dataFrame$num_planned <- fileData$num_planned
+dataFrame$iterative <- seq( 1, nrow( fileData ), by = 1 )
+
+print( "Data Frame Results:" )
+print( dataFrame )
+
+# **********************************************************
+# STEP 3: Generate graphs.
+# **********************************************************
+
+print( "**********************************************************" )
+print( "STEP 3: Generate Graph." )
+print( "**********************************************************" )
+
+# -------------------
+# Main Plot Generated
+# -------------------
+
+print( "Creating main plot." )
+# Create the primary plot here.
+# ggplot contains the following arguments:
+# - data: the data frame that the graph will be based off of
+# - aes: the asthetics of the graph which require:
+# - x: x-axis values (usually iterative, but it will become build # later)
+# - y: y-axis values (usually tests)
+# - color: the category of the colored lines (usually status of test)
+
+mainPlot <- ggplot( data = dataFrame, aes( x = iterative,
+ y = results,
+ color = status ) )
+
+# -------------------
+# Main Plot Formatted
+# -------------------
+
+print( "Formatting main plot." )
+
+# geom_ribbon is used so that there is a colored fill below the lines. These values shouldn't be changed.
+failedColor <- geom_ribbon( aes( ymin = 0,
+ ymax = dataFrame$num_failed ),
+ fill = "#ff0000",
+ linetype = 0,
+ alpha = 0.07 )
+
+passedColor <- geom_ribbon( aes( ymin = 0,
+ ymax = dataFrame$num_passed ),
+ fill = "#0083ff",
+ linetype = 0,
+ alpha = 0.05 )
+
+plannedColor <- geom_ribbon( aes( ymin = 0,
+ ymax = dataFrame$num_planned ),
+ fill = "#000000",
+ linetype = 0,
+ alpha = 0.01 )
+
+# Colors for the lines
+lineColors <- scale_color_manual( values=c( "#ff0000", # fail
+ "#0083ff", # pass
+ "#000000"),
+ labels = c( "Containing Failures",
+ "No Failures",
+ "Total Built" ) ) # planned
+
+# ------------------------------
+# Fundamental Variables Assigned
+# ------------------------------
+
+print( "Generating fundamental graph data." )
+
+theme_set( theme_grey( base_size = 26 ) ) # set the default text size of the graph.
+
+xScaleConfig <- scale_x_continuous( breaks = dataFrame$iterative,
+ label = dataFrame$build )
+yScaleConfig <- scale_y_continuous( breaks = seq( 0, max( dataFrame$results ),
+ by = ceiling( max( dataFrame$results ) / 10 ) ) )
+
+xLabel <- xlab( "Build Number" )
+yLabel <- ylab( "Tests" )
+
+imageWidth <- 15
+imageHeight <- 10
+imageDPI <- 200
+
+# Set other graph configurations here.
+theme <- theme( plot.title = element_text( hjust = 0.5, size = 32, face ='bold' ),
+ axis.text.x = element_text( angle = 0, size = 14 ),
+ legend.position = "bottom",
+ legend.text = element_text( size = 22 ),
+ legend.title = element_blank(),
+ legend.key.size = unit( 1.5, 'lines' ),
+ plot.subtitle = element_text( size=16, hjust=1.0 ) )
+
+subtitle <- paste( "Last Updated: ", format( Sys.time(), format = "%b %d, %Y at %I:%M %p %Z" ), sep="" )
+
+title <- labs( title = title, subtitle = subtitle )
+
+# Store plot configurations as 1 variable
+fundamentalGraphData <- mainPlot +
+ plannedColor +
+ passedColor +
+ failedColor +
+ xScaleConfig +
+ yScaleConfig +
+ xLabel +
+ yLabel +
+ theme +
+ title +
+ lineColors
+
+# ----------------------------
+# Generating Line Graph Format
+# ----------------------------
+
+print( "Generating line graph." )
+
+lineGraphFormat <- geom_line( size = 1.1 )
+pointFormat <- geom_point( size = 3 )
+
+result <- fundamentalGraphData +
+ lineGraphFormat +
+ pointFormat
+
+# -----------------------
+# Exporting Graph to File
+# -----------------------
+
+print( paste( "Saving result graph to", outputFile ) )
+
+tryCatch( ggsave( outputFile,
+ width = imageWidth,
+ height = imageHeight,
+ dpi = imageDPI ),
+ error = function( e ){
+ print( "[ERROR] There was a problem saving the graph due to a graph formatting exception. Error dump:" )
+ print( e )
+ quit( status = 1 )
+ }
+ )
+
+print( paste( "[SUCCESS] Successfully wrote result graph out to", outputFile ) )
+quit( status = 0 )
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index cf3eec6..915c29b 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1416,7 +1416,7 @@
"type": "IP_PROTO",
"protocol": ipProto } )
- return self.sendFlow( deviceId=deviceId, flowJson=flowJson, debug=debug )
+ return self.sendFlow( deviceId=deviceId, flowJson=flowJson, debug=debug, ip=ip, port=port )
except ( AttributeError, TypeError ):
main.log.exception( self.name + ": Object not as expected" )
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 25cafe0..580b3b5 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -153,7 +153,7 @@
# Sudo asking for password
main.log.info( self.name + ": Sending sudo password" )
self.handle.sendline( self.pwd )
- i = self.handle.expect( [ '%s:' % self.user,
+ i = self.handle.expect( [ '%s:' % self.user_name,
self.prompt,
pexpect.EOF,
pexpect.TIMEOUT ],
diff --git a/TestON/drivers/common/cli/emulator/mininetscapyclidriver.py b/TestON/drivers/common/cli/emulator/mininetscapyclidriver.py
new file mode 100644
index 0000000..4874c02
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/mininetscapyclidriver.py
@@ -0,0 +1,257 @@
+#!/usr/bin/env python
+"""
+2015-2016
+Copyright 2016 Open Networking Foundation (ONF)
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+( at your option ) any later version.
+
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with TestON. If not, see <http://www.gnu.org/licenses/>.
+
+MininetScapyCliDriver is for controlling scapy hosts running in Mininet
+
+TODO: Add Explanation on how to install scapy
+"""
+import pexpect
+import re
+import sys
+import types
+import os
+from drivers.common.cli.emulator.scapyclidriver import ScapyCliDriver
+
+
+class MininetScapyCliDriver( ScapyCliDriver ):
+ """
+ MininetScapyCliDriver is for controlling scapy hosts running in Mininet
+ """
+ def __init__( self ):
+ super( MininetScapyCliDriver, self ).__init__()
+ self.handle = self
+ self.name = None
+ self.home = None
+ self.wrapped = sys.modules[ __name__ ]
+ self.flag = 0
+ self.hostPrompt = "~#"
+ self.scapyPrompt = ">>>"
+
+ def connect( self, **connectargs ):
+ """
+ Here the main is the TestON instance after creating
+ all the log handles.
+ """
+ try:
+ for key in connectargs:
+ vars( self )[ key ] = connectargs[ key ]
+ self.home = self.options[ 'home' ] if 'home' in self.options.keys() else "~/mininet"
+ self.name = self.options[ 'name' ]
+ self.ifaceName = self.options[ 'ifaceName' ] if 'ifaceName' in self.options.keys() else self.name + "-eth0"
+
+ try:
+ if os.getenv( str( self.ip_address ) ) is not None:
+ self.ip_address = os.getenv( str( self.ip_address ) )
+ else:
+ main.log.info( self.name +
+ ": Trying to connect to " +
+ self.ip_address )
+
+ except KeyError:
+ main.log.info( "Invalid host name," +
+ " connecting to local host instead" )
+ self.ip_address = 'localhost'
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
+ self.handle = super(
+ ScapyCliDriver,
+ self ).connect(
+ user_name=self.user_name,
+ ip_address=self.ip_address,
+ port=None,
+ pwd=self.pwd )
+
+ if self.handle:
+ main.log.info( "Connection successful to the host " +
+ self.user_name +
+ "@" +
+ self.ip_address )
+ return main.TRUE
+ else:
+ main.log.error( "Connection failed to the host " +
+ self.user_name +
+ "@" +
+ self.ip_address )
+ main.log.error( "Failed to connect to the Mininet Host" )
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def disconnect( self ):
+ """
+ Called at the end of the test to stop the scapy component and
+ disconnect the handle.
+ """
+ self.handle.sendline( '' )
+ i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
+ timeout=2 )
+ response = main.TRUE
+ if i == 0:
+ response = self.stopNet()
+ elif i == 1:
+ return main.TRUE
+ # print "Disconnecting Mininet"
+ if self.handle:
+ self.handle.sendline( "exit" )
+ self.handle.expect( "exit" )
+ self.handle.expect( "(.*)" )
+ else:
+ main.log.error( "Connection failed to the host" )
+ return response
+
+ def stopNet( self, fileName="", timeout=5 ):
+ """
+ Stops mininet.
+ Returns main.TRUE if the mininet successfully stops and
+ main.FALSE if the pexpect handle does not exist.
+
+ Will cleanup and exit the test if scapy fails to stop
+ """
+ main.log.info( self.name + ": Stopping scapy..." )
+ response = ''
+ if self.handle:
+ try:
+ self.handle.sendline( "" )
+ i = self.handle.expect( [ '>>>',
+ self.prompt,
+ pexpect.EOF,
+ pexpect.TIMEOUT ],
+ timeout )
+ if i == 0:
+ main.log.info( "Exiting scapy..." )
+ response = self.execute(
+ cmd="exit",
+ prompt="(.*)",
+ timeout=120 )
+ main.log.info( self.name + ": Stopped" )
+ response = main.TRUE
+
+ if i == 1:
+ main.log.info( " Mininet trying to exit while not " +
+ "in the mininet prompt" )
+ elif i == 2:
+ main.log.error( "Something went wrong exiting mininet" )
+ elif i == 3: # timeout
+ main.log.error( "Something went wrong exiting mininet " +
+ "TIMEOUT" )
+
+ if fileName:
+ self.handle.sendline( "" )
+ self.handle.expect( self.prompt )
+ self.handle.sendline(
+ "sudo kill -9 \`ps -ef | grep \"" +
+ fileName +
+ "\" | grep -v grep | awk '{print $2}'\`" )
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ else:
+ main.log.error( self.name + ": Connection failed to the host" )
+ response = main.FALSE
+ return response
+
+ def createHostComponent( self, name ):
+ """
+ Creates a new mininet cli component with the same parameters as self.
+ This new component is intended to be used to login to the hosts created
+ by mininet.
+
+ Arguments:
+ name - The string of the name of this component. The new component
+ will be assigned to main.<name> .
+ In addition, main.<name>.name = str( name )
+ """
+ try:
+ # look to see if this component already exists
+ getattr( main, name )
+ except AttributeError:
+ # namespace is clear, creating component
+ main.componentDictionary[ name ] = main.componentDictionary[ self.name ].copy()
+ main.componentDictionary[ name ][ 'connect_order' ] = str( int( main.componentDictionary[ name ][ 'connect_order' ] ) + 1 )
+ main.componentInit( name )
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+ else:
+ # namespace is not clear!
+ main.log.error( name + " component already exists!" )
+ main.cleanAndExit()
+
+ def removeHostComponent( self, name ):
+ """
+ Remove host component
+ Arguments:
+ name - The string of the name of the component to delete.
+ """
+ try:
+ # Get host component
+ component = getattr( main, name )
+ except AttributeError:
+ main.log.error( "Component " + name + " does not exist." )
+ return main.FALSE
+ try:
+ # Disconnect from component
+ component.disconnect()
+ # Delete component
+ delattr( main, name )
+ # Delete component from ComponentDictionary
+ del( main.componentDictionary[ name ] )
+ return main.TRUE
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def startHostCli( self, host=None ):
+ """
+ Use the mininet m utility to connect to the host's cli
+ """
+ # These are fields that can be used by scapy packets. Initialized to None
+ self.hostIp = None
+ self.hostMac = None
+ try:
+ if not host:
+ host = self.name
+ self.handle.sendline( self.home + "/util/m " + host )
+ self.handle.sendline( "cd" )
+ self.handle.expect( self.hostPrompt )
+ self.handle.sendline( "" )
+ self.handle.expect( self.hostPrompt )
+ return main.TRUE
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": Command timed out" )
+ return main.FALSE
+ except pexpect.EOF:
+ main.log.exception( self.name + ": connection closed." )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+if __name__ != "__main__":
+ sys.modules[ __name__ ] = MininetScapyCliDriver()
diff --git a/TestON/drivers/common/cli/emulator/scapyclidriver.py b/TestON/drivers/common/cli/emulator/scapyclidriver.py
index 6ef63c4..418aa9e 100644
--- a/TestON/drivers/common/cli/emulator/scapyclidriver.py
+++ b/TestON/drivers/common/cli/emulator/scapyclidriver.py
@@ -45,8 +45,7 @@
self.wrapped = sys.modules[ __name__ ]
self.flag = 0
# TODO: Refactor driver to use these everywhere
- self.hostPrompt = "~#"
- self.bashPrompt = "\$"
+ self.hostPrompt = "\$"
self.scapyPrompt = ">>>"
def connect( self, **connectargs ):
@@ -56,15 +55,9 @@
try:
for key in connectargs:
vars( self )[ key ] = connectargs[ key ]
- self.home = "~/mininet"
+ self.home = self.options[ 'home' ] if 'home' in self.options.keys() else "~/"
self.name = self.options[ 'name' ]
- for key in self.options:
- if key == "home":
- self.home = self.options[ 'home' ]
- break
- if self.home is None or self.home == "":
- self.home = "~/mininet"
-
+ self.ifaceName = self.options[ 'ifaceName' ] if 'ifaceName' in self.options.keys() else self.name + "-eth0"
try:
if os.getenv( str( self.ip_address ) ) is not None:
self.ip_address = os.getenv( str( self.ip_address ) )
@@ -114,152 +107,19 @@
Called at the end of the test to stop the scapy component and
disconnect the handle.
"""
- self.handle.sendline( '' )
- i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
- timeout=2 )
response = main.TRUE
- if i == 0:
- response = self.stopNet()
- elif i == 1:
- return main.TRUE
- # print "Disconnecting Mininet"
- if self.handle:
- self.handle.sendline( "exit" )
- self.handle.expect( "exit" )
- self.handle.expect( "(.*)" )
- else:
- main.log.error( "Connection failed to the host" )
- return response
-
- def stopNet( self, fileName="", timeout=5 ):
- """
- Stops mininet.
- Returns main.TRUE if the mininet successfully stops and
- main.FALSE if the pexpect handle does not exist.
-
- Will cleanup and exit the test if scapy fails to stop
- """
- main.log.info( self.name + ": Stopping scapy..." )
- response = ''
- if self.handle:
- try:
- self.handle.sendline( "" )
- i = self.handle.expect( [ '>>>',
- self.prompt,
- pexpect.EOF,
- pexpect.TIMEOUT ],
- timeout )
- if i == 0:
- main.log.info( "Exiting scapy..." )
- response = self.execute(
- cmd="exit",
- prompt="(.*)",
- timeout=120 )
- main.log.info( self.name + ": Stopped" )
- response = main.TRUE
-
- if i == 1:
- main.log.info( " Mininet trying to exit while not " +
- "in the mininet prompt" )
- elif i == 2:
- main.log.error( "Something went wrong exiting mininet" )
- elif i == 3: # timeout
- main.log.error( "Something went wrong exiting mininet " +
- "TIMEOUT" )
-
- if fileName:
- self.handle.sendline( "" )
- self.handle.expect( self.prompt )
- self.handle.sendline(
- "sudo kill -9 \`ps -ef | grep \"" +
- fileName +
- "\" | grep -v grep | awk '{print $2}'\`" )
- except pexpect.EOF:
- main.log.error( self.name + ": EOF exception found" )
- main.log.error( self.name + ": " + self.handle.before )
- main.cleanAndExit()
- else:
- main.log.error( self.name + ": Connection failed to the host" )
+ try:
+ if self.handle:
+ self.handle.sendline( "exit" )
+ self.handle.expect( "closed" )
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ except Exception:
+ main.log.exception( self.name + ": Connection failed to the host" )
response = main.FALSE
return response
- def createHostComponent( self, name ):
- """
- Creates a new mininet cli component with the same parameters as self.
- This new component is intended to be used to login to the hosts created
- by mininet.
-
- Arguments:
- name - The string of the name of this component. The new component
- will be assigned to main.<name> .
- In addition, main.<name>.name = str( name )
- """
- try:
- # look to see if this component already exists
- getattr( main, name )
- except AttributeError:
- # namespace is clear, creating component
- main.componentDictionary[ name ] = main.componentDictionary[ self.name ].copy()
- main.componentDictionary[ name ][ 'connect_order' ] = str( int( main.componentDictionary[ name ][ 'connect_order' ] ) + 1 )
- main.componentInit( name )
- except Exception:
- main.log.exception( self.name + ": Uncaught exception!" )
- main.cleanAndExit()
- else:
- # namespace is not clear!
- main.log.error( name + " component already exists!" )
- main.cleanAndExit()
-
- def removeHostComponent( self, name ):
- """
- Remove host component
- Arguments:
- name - The string of the name of the component to delete.
- """
- try:
- # Get host component
- component = getattr( main, name )
- except AttributeError:
- main.log.error( "Component " + name + " does not exist." )
- return main.FALSE
- try:
- # Disconnect from component
- component.disconnect()
- # Delete component
- delattr( main, name )
- # Delete component from ComponentDictionary
- del( main.componentDictionary[ name ] )
- return main.TRUE
- except Exception:
- main.log.exception( self.name + ": Uncaught exception!" )
- main.cleanAndExit()
-
- def startHostCli( self, host=None ):
- """
- Use the mininet m utility to connect to the host's cli
- """
- # These are fields that can be used by scapy packets. Initialized to None
- self.hostIp = None
- self.hostMac = None
- try:
- if not host:
- host = self.name
- self.handle.sendline( self.home + "/util/m " + host )
- self.handle.sendline( "cd" )
- self.handle.expect( self.hostPrompt )
- self.handle.sendline( "" )
- self.handle.expect( self.hostPrompt )
- return main.TRUE
- except pexpect.TIMEOUT:
- main.log.exception( self.name + ": Command timed out" )
- return main.FALSE
- except pexpect.EOF:
- main.log.exception( self.name + ": connection closed." )
- main.cleanAndExit()
- except Exception:
- main.log.exception( self.name + ": Uncaught exception!" )
- main.cleanAndExit()
-
def startScapy( self, mplsPath="" ):
"""
Start the Scapy cli
@@ -847,7 +707,7 @@
Options:
ifaceName - the name of the interface to listen on. If none is given,
- defaults to <host name>-eth0
+ defaults to self.ifaceName which is <host name>-eth0
pktFilter - A string in Berkeley Packet Filter (BPF) format which
specifies which packets to sniff
sniffCount - The number of matching packets to capture before returning
@@ -856,7 +716,7 @@
"""
try:
# TODO: add all params, or use kwargs
- ifaceName = str( ifaceName ) if ifaceName else self.name + "-eth0"
+ ifaceName = str( ifaceName ) if ifaceName else self.ifaceName
# Set interface
self.handle.sendline( ' conf.iface = "' + ifaceName + '"' )
self.handle.expect( self.scapyPrompt )
@@ -946,7 +806,7 @@
Save host's MAC address
"""
try:
- ifaceName = str( ifaceName ) if ifaceName else self.name + "-eth0"
+ ifaceName = str( ifaceName ) if ifaceName else self.ifaceName
cmd = 'get_if_hwaddr("' + str( ifaceName ) + '")'
self.handle.sendline( cmd )
self.handle.expect( self.scapyPrompt )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 218b1e8..db0b48c 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2376,9 +2376,11 @@
# get total and installed number, see if they are match
allState = response.get( 'all' )
if allState.get( 'total' ) == allState.get( 'installed' ):
- main.log.info( 'Total Intents: {} Installed Intents: {}'.format( allState.get( 'total' ), allState.get( 'installed' ) ) )
+ main.log.info( 'Total Intents: {} Installed Intents: {}'.format(
+ allState.get( 'total' ), allState.get( 'installed' ) ) )
return main.TRUE
- main.log.info( 'Verified Intents failed Excepte intetnes: {} installed intents: {}'.format( allState.get( 'total' ), allState.get( 'installed' ) ) )
+ main.log.info( 'Verified Intents failed Expected intents: {} installed intents: {}'.format(
+ allState.get( 'total' ), allState.get( 'installed' ) ) )
return main.FALSE
except ( TypeError, ValueError ):
@@ -3803,12 +3805,12 @@
result = main.FALSE
# get the entry in ids that has the same appID
current = filter( lambda item: item[ 'id' ] == appID, ids )
- # main.log.debug( "Comparing " + str( app ) + " to " +
- # str( current ) )
if not current: # if ids doesn't have this id
result = main.FALSE
main.log.error( "'app-ids' does not have the ID for " +
str( appName ) + " that apps does." )
+ main.log.debug( "apps command returned: " + str( app ) +
+ "; app-ids has: " + str( ids ) )
elif len( current ) > 1:
# there is more than one app with this ID
result = main.FALSE
@@ -5055,7 +5057,8 @@
logPaths = logPath + str( i ) + " " + logPaths
cmd = "cat " + logPaths
if startLine:
- # 100000000 is just a extreme large number to make sure this function can grep all the lines after startLine
+ # 100000000 is just a extreme large number to make sure this function can
+ # grep all the lines after startLine
cmd = cmd + " | grep -A 100000000 \'" + startLine + "\'"
if mode == 'all':
cmd = cmd + " | grep \'" + searchTerm + "\'"
@@ -5735,3 +5738,237 @@
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
+
+ def issu( self ):
+ """
+ Short summary of In-Service Software Upgrade status
+
+ Returns the output of the cli command or None on Error
+ """
+ try:
+ cmdStr = "issu"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ return handle
+ except AssertionError:
+ main.log.exception( "" )
+ return None
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuInit( self ):
+ """
+ Initiates an In-Service Software Upgrade
+
+ Returns main.TRUE on success, main.ERROR on error, else main.FALSE
+ """
+ try:
+ cmdStr = "issu init"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ if "Initialized" in handle:
+ return main.TRUE
+ else:
+ return main.FALSE
+ except AssertionError:
+ main.log.exception( "" )
+ return main.ERROR
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuUpgrade( self ):
+ """
+ Transitions stores to upgraded nodes
+
+ Returns main.TRUE on success, main.ERROR on error, else main.FALSE
+ """
+ try:
+ cmdStr = "issu upgrade"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ if "Upgraded" in handle:
+ return main.TRUE
+ else:
+ return main.FALSE
+ except AssertionError:
+ main.log.exception( "" )
+ return main.ERROR
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuCommit( self ):
+ """
+ Finalizes an In-Service Software Upgrade
+
+ Returns main.TRUE on success, main.ERROR on error, else main.FALSE
+ """
+ try:
+ cmdStr = "issu commit"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ # TODO: Check the version returned by this command
+ if "Committed version" in handle:
+ return main.TRUE
+ else:
+ return main.FALSE
+ except AssertionError:
+ main.log.exception( "" )
+ return main.ERROR
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuRollback( self ):
+ """
+ Rolls back an In-Service Software Upgrade
+
+ Returns main.TRUE on success, main.ERROR on error, else main.FALSE
+ """
+ try:
+ cmdStr = "issu rollback"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ # TODO: Check the version returned by this command
+ if "Rolled back to version" in handle:
+ return main.TRUE
+ else:
+ return main.FALSE
+ except AssertionError:
+ main.log.exception( "" )
+ return main.ERROR
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuReset( self ):
+ """
+ Resets the In-Service Software Upgrade status after a rollback
+
+ Returns main.TRUE on success, main.ERROR on error, else main.FALSE
+ """
+ try:
+ cmdStr = "issu reset"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ # TODO: Check the version returned by this command
+ if "Reset version" in handle:
+ return main.TRUE
+ else:
+ return main.FALSE
+ except AssertionError:
+ main.log.exception( "" )
+ return main.ERROR
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return main.ERROR
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuStatus( self ):
+ """
+ Status of an In-Service Software Upgrade
+
+ Returns the output of the cli command or None on Error
+ """
+ try:
+ cmdStr = "issu status"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ return handle
+ except AssertionError:
+ main.log.exception( "" )
+ return None
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+
+ def issuVersion( self ):
+ """
+ Get the version of an In-Service Software Upgrade
+
+ Returns the output of the cli command or None on Error
+ """
+ try:
+ cmdStr = "issu version"
+ handle = self.sendline( cmdStr )
+ assert handle is not None, "Error in sendline"
+ assert "Command not found:" not in handle, handle
+ assert "Unsupported command:" not in handle, handle
+ return handle
+ except AssertionError:
+ main.log.exception( "" )
+ return None
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 31f26d5..f8c77e9 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -820,11 +820,9 @@
"""
Calls 'cell <name>' to set the environment variables on ONOSbench
"""
- import re
try:
if not cellname:
- main.log.error( "Must define cellname" )
-
+ main.log.error( self.name + ": Must define cellname" )
main.cleanAndExit()
else:
self.handle.sendline( "cell " + str( cellname ) )
@@ -832,21 +830,25 @@
# Note that this variable name is subject to change
# and that this driver will have to change accordingly
self.handle.expect( str( cellname ) )
- handleBefore = self.handle.before
- handleAfter = self.handle.after
- # Get the rest of the handle
- self.handle.expect( self.prompt )
- time.sleep( 10 )
- handleMore = self.handle.before
-
- cell_result = handleBefore + handleAfter + handleMore
- # print cell_result
- if( re.search( "No such cell", cell_result ) ):
- main.log.error( "Cell call returned: " + handleBefore +
- handleAfter + handleMore )
-
+ i = self.handle.expect( [ "No such cell",
+ self.prompt,
+ pexpect.TIMEOUT ], timeout=10 )
+ if i == 0:
+ main.log.error( self.name + ": No such cell. Response: " + str( self.handle.before ) )
+ main.cleanAndExit()
+ elif i == 1:
+ main.log.info( self.name + ": Successfully set cell: " + str( self.handle.before ) )
+ elif i == 2:
+ main.log.error( self.name + ": Set cell timed out. Response: " + str( self.handle.before ) )
+ main.cleanAndExit()
+ else:
+ main.log.error( self.name + ": Unexpected response: " + str( self.handle.before ) )
main.cleanAndExit()
return main.TRUE
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": TIMEOUT exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -1335,14 +1337,17 @@
self.handle.sendline( "onos-wait-for-start " + node )
self.handle.expect( "onos-wait-for-start" )
# NOTE: this timeout is arbitrary"
- i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ], timeout )
+ i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT, "Password:" ], timeout )
if i == 0:
main.log.info( self.name + ": " + node + " is up" )
return main.TRUE
- elif i == 1:
+ elif i == 1 or i == 2:
# NOTE: since this function won't return until ONOS is ready,
# we will kill it on timeout
- main.log.error( "ONOS has not started yet" )
+ if i == 1:
+ main.log.error( "ONOS has not started yet" )
+ elif i == 2:
+ main.log.error( "Cannot login to ONOS CLI, try using onos-secure-ssh" )
self.handle.send( "\x03" ) # Control-C
self.handle.expect( self.prompt )
return main.FALSE
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 0f3140a..10b5152 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -56,20 +56,22 @@
self.ip_address + " port 22: Connection refused"
if self.port:
self.handle = pexpect.spawn(
- 'ssh -p ' +
+ 'ssh -X -p ' +
self.port +
' ' +
self.user_name +
'@' +
- self.ip_address,
+ self.ip_address +
+ ' -o ServerAliveInterval=120 -o TCPKeepAlive=yes',
env={ "TERM": "xterm-mono" },
- maxread=50000 )
+ maxread=1000000 )
else:
self.handle = pexpect.spawn(
'ssh -X ' +
self.user_name +
'@' +
- self.ip_address,
+ self.ip_address +
+ ' -o ServerAliveInterval=120 -o TCPKeepAlive=yes',
env={ "TERM": "xterm-mono" },
maxread=1000000,
timeout=60 )
diff --git a/TestON/install.sh b/TestON/install.sh
index 80ba1e5..67b5625 100755
--- a/TestON/install.sh
+++ b/TestON/install.sh
@@ -128,6 +128,28 @@
$cmd -r requirements.txt
}
+function jenkins_req {
+ set +o nounset
+ if [ -z $1 ]
+ then
+ dir='/var/jenkins'
+ else
+ dir=$1
+ fi
+ set -o nounset
+ # make sure default jenkin's directory exists and is owned by current user?
+ set +e
+ sudo mkdir $dir
+ set -e
+ sudo chown $USER:$USER $dir
+ # Postgresql for storing results in the db
+ echo "Installing dependencies required for Jenkins test-station"
+ $install postgresql postgresql-contrib
+ # R for generating graphs for the wiki summary
+ $install r-base-core libpq-dev
+ echo 'cat(".Rprofile: Setting UK repository"); r = getOption("repos"); r["CRAN"] = "http://cran.uk.r-project.org"; options(repos = r); rm(r)' > ~/.Rprofile
+ sudo R -e 'install.packages( c( "ggplot2", "reshape2", "RPostgreSQL" ) )'
+}
function symlinks {
set +e
# Add symbolic link to main TestON folder in Home dir
@@ -214,7 +236,7 @@
# TODO Add bash tab completion script to this
function usage {
- printf "Usage: $(basename $0) [-dgprsv] \n"
+ printf "Usage: $(basename $0) [-dgjprsv] \n"
printf "Usage: $(basename $0) -y [PATH] \n\n"
printf "This install script attempts to install deoendencies needed to run teston\n"
printf "and any tests included in the official repository. If a test still does \n"
@@ -226,11 +248,12 @@
printf "Options:\n"
printf "\t -d (default) requirements, symlinks and git hooks\n"
printf "\t -g install git hooks\n"
+ printf "\t -j install requirments for running this node as a Jenkin's test-station\n"
printf "\t -p install pypy in a virtual env\n"
printf "\t -r install requirements for TestON/tests\n"
printf "\t -s install symlinks\n"
printf "\t -v install a python virtual environment for teston using the default python implementation\n"
- printf "\t -y <PATH> install a python virtual environment for testonusing a specific python implementation at PATH.\n"
+ printf "\t -y <PATH> install a python virtual environment for teston using a specific python implementation at PATH.\n"
}
@@ -243,16 +266,17 @@
usage
else
init
- while getopts 'dgprsvy:' OPTION
+ while getopts 'dgjprsvy:' OPTION
do
case $OPTION in
d) default;;
g) git;;
+ j) jenkins_req;;
p) get_pypy;;
r) requirements;;
s) symlinks;;
v) venv;;
- y) venv $OPTARG;;
+ y) venv $OPTARG;;
?) usage;;
esac
done
diff --git a/TestON/requirements.txt b/TestON/requirements.txt
index 08e9840..5221210 100644
--- a/TestON/requirements.txt
+++ b/TestON/requirements.txt
@@ -9,7 +9,7 @@
pexpect==3.2
pyflakes==0.8.1
pylint==1.1.0
-requests==2.2.1
+requests==2.6.0
scapy==2.3.1
ipaddress==1.0.16
docker==2.1.0
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index b1b9d0f..00afaf6 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -41,6 +41,10 @@
<testDuration>86400</testDuration>
<package>on</package>
</TEST>
+ <GRAPH>
+ <nodeCluster>CHO</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
<ENV>
<cellName>choCell</cellName>
<cellApps>drivers,openflow,proxyarp,events</cellApps>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index b7825e8..3efb3cc 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -98,7 +98,7 @@
main.testSetUp.evnSetupConclusion( stepResult )
- setupResult = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
+ setupResult = main.testSetUp.ONOSSetUp( main.Cluster,
cellName=main.onosCell )
for i in range( 1, main.Cluster.numCtrls + 1 ):
newController = Controller( i )
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index bd35266..dd2d2cc 100644
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -76,8 +76,8 @@
except Exception as e:
main.testSetUp.envSetupException( e )
- cliResults = main.testSetUp.ONOSSetUp( main.scapy_ip, main.Cluster,
- cellName=main.cellName, removeLog=True )
+ cliResults = main.testSetUp.ONOSSetUp( main.Cluster, cellName=main.cellName,
+ mininetIp=main.scapy_ip, removeLog=True )
main.step( "App Ids check" )
appCheck = main.Cluster.active( 0 ).CLI.appToIDCheck()
@@ -450,7 +450,7 @@
bgplsConfig = BgpLs()
bgplsConfig.ipValue( main.ipList, main.scapy_ip )
- main.testSetUp.createApplyCell( main.Cluster, True, main.cellName, main.scapy_ip, True, main.ipList )
+ main.testSetUp.createApplyCell( main.Cluster, True, main.cellName, main.apps, main.scapy_ip, True, main.ipList )
bgplsConfig.Comments()
main.testSetUp.startOnosClis( main.Cluster )
bgplsConfig.Comments()
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.topo b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.topo
index c8b48a0..1dd294d 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.topo
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.topo
@@ -25,7 +25,7 @@
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
- <type>ScapyCliDriver</type>
+ <type>MininetScapyCliDriver</type>
<connect_order>2</connect_order>
<COMPONENTS>
<prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.params b/TestON/tests/FUNC/FUNCflow/FUNCflow.params
index 6eda334..f40372c 100755
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.params
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.params
@@ -6,6 +6,8 @@
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - install ONOS
# 10 - Start mininet and verify topology
+ # 11 - Start mininet scapy hosts
+ # 12 - Stop mininet and scapy hosts
# 66 - Testing Scapy
# 100 - Check logs for Errors and Warnings
# 1000 - Add flows with MAC selector
@@ -21,7 +23,7 @@
# 2000 - Add flows with ICMPv6 selector
# 3000 - Delete flows
- <testcases>1,2,10,1000,3000,1100,3000,1200,3000,1300,3000,1400,3000,1500,3000,1600,3000,1700,3000,1800,3000,1900,3000,2000,100</testcases>
+ <testcases>1,2,10,11,1000,3000,1100,3000,1200,3000,1300,3000,1400,3000,1500,3000,1600,3000,1700,3000,1800,3000,1900,3000,2000,12,100</testcases>
<GRAPH>
<nodeCluster>VM</nodeCluster>
@@ -82,4 +84,8 @@
<delFlow>10</delFlow>
</SLEEP>
+ <SCAPY>
+ <HOSTNAMES>h1,h2,h3,h4,h5,h6</HOSTNAMES>
+ </SCAPY>
+
</PARAMS>
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index e900648..f161202 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
@@ -59,6 +59,8 @@
main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
main.debug = main.params[ 'DEBUG' ]
main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
+ main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
+ main.scapyHosts = [] # List of scapy hosts for iterating
main.debug = True if "on" in main.debug else False
@@ -102,7 +104,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster )
+ main.testSetUp.ONOSSetUp( main.Cluster )
def CASE10( self, main ):
"""
@@ -145,17 +147,77 @@
main.topoRelated.compareTopos( main.Mininet1 )
+ def CASE11( self, main ):
+ """
+ Start Scapy with Mininet
+ """
+ main.case( "Starting scapy with Mininet" )
+ main.step( "Creating Host component" )
+ scapyResult = main.TRUE
+ for hostName in main.scapyHostNames:
+ main.Scapy.createHostComponent( hostName )
+ main.scapyHosts.append( getattr( main, hostName ) )
+
+ main.step( "Start scapy components" )
+ for host in main.scapyHosts:
+ host.startHostCli()
+ host.startScapy()
+ host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully created Scapy Components",
+ onfail="Failed to discover Scapy Components" )
+
+ def CASE12( self, main ):
+ """
+ Stop mininet and remove scapy host
+ """
+ try:
+ from tests.dependencies.utils import Utils
+ except ImportError:
+ main.log.error( "Utils not found exiting the test" )
+ main.cleanAndExit()
+ try:
+ main.Utils
+ except ( NameError, AttributeError ):
+ main.Utils = Utils()
+ main.log.report( "Stop Mininet and Scapy" )
+ main.case( "Stop Mininet and Scapy" )
+ main.caseExplanation = "Stopping the current mininet topology " +\
+ "to start up fresh"
+ main.step( "Stopping and Removing Scapy Host Components" )
+ scapyResult = main.TRUE
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and host.stopScapy()
+ main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
+
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and main.Scapy.removeHostComponent( host.name )
+ main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
+
+ main.scapyHosts = []
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully stopped scapy and removed host components",
+ onfail="Failed to stop mininet and scapy" )
+
+ mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
+ # Exit if topology did not load properly
+ if not ( mininetResult and scapyResult ):
+ main.cleanAndExit()
+
def CASE66( self, main ):
"""
Testing scapy
"""
main.case( "Testing scapy" )
- main.step( "Creating Host1 component" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
main.log.debug( host.name )
@@ -210,12 +272,6 @@
onpass="Pass",
onfail="Fail" )
- main.step( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
def CASE1000( self, main ):
"""
Add flows with MAC selectors and verify the flows
@@ -229,15 +285,13 @@
"send a packet that only specifies the MAC src and dst."
main.step( "Add flows with MAC addresses as the only selectors" )
-
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
# send output on port2
@@ -288,12 +342,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -312,15 +360,13 @@
"send a packet that only specifies the IP src and dst."
main.step( "Add flows with IPv4 addresses as the only selectors" )
-
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
# send output on port2
@@ -371,12 +417,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -394,17 +434,13 @@
"send a packet that only specifies the IP src and dst."
main.step( "Add flows with IPv6 addresses as the only selectors" )
-
- main.log.info( "Creating host components" )
- ctrl = main.Cluster.active( 0 )
- main.Scapy.createHostComponent( "h5" )
- main.Scapy.createHostComponent( "h6" )
- hosts = [ main.h5, main.h6 ]
-
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf( IPv6=True )
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
# send output on port2
@@ -454,12 +490,6 @@
else:
main.h6.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h5" )
- main.Mininet1.removeHostComponent( "h6" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -477,16 +507,13 @@
"specified, then verify the flow is added in ONOS, and finally " +\
"broadcast a packet with the correct VLAN tag."
- # We do this here to utilize the hosts information
- main.log.info( "Creating host components" )
- ctrl = main.Cluster.active( 0 )
- main.Scapy.createHostComponent( "h3" )
- main.Scapy.createHostComponent( "h4" )
- hosts = [ main.h3, main.h4 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
main.step( "Add a flow with the VLAN tag as the only selector" )
@@ -539,12 +566,6 @@
else:
main.h4.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h3" )
- main.Mininet1.removeHostComponent( "h4" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -563,16 +584,15 @@
"send a packet via scapy that has a MPLS label."
main.step( "Add a flow with a MPLS selector" )
-
- main.log.info( "Creating host components" )
- ctrl = main.Cluster.active( 0 )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy( main.dependencyPath )
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
+ ctrl = main.Cluster.active( 0 )
# ports
egress = 2
@@ -655,12 +675,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -680,14 +694,13 @@
main.step( "Add a flow with a TCP selector" )
ctrl = main.Cluster.active( 0 )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
egress = 2
@@ -740,12 +753,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -765,14 +772,13 @@
main.step( "Add a flow with a UDP selector" )
ctrl = main.Cluster.active( 0 )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
egress = 2
@@ -825,12 +831,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -850,14 +850,13 @@
main.step( "Add a flow with a ICMPv4 selector" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
egress = 2
@@ -907,12 +906,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -932,14 +925,13 @@
main.step( "Add a flow with a ICMPv6 selector" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h5" )
- main.Scapy.createHostComponent( "h6" )
- hosts = [ main.h5, main.h6 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf( IPv6=True )
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
egress = 6
@@ -989,12 +981,6 @@
else:
main.h6.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h5" )
- main.Mininet1.removeHostComponent( "h6" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -1047,14 +1033,14 @@
main.step( "Add flows with ARP addresses as the only selectors" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
ctrl = main.Cluster.active( 0 )
# Add a flow that connects host1 on port1 to host2 on port2
# send output on port2
@@ -1104,12 +1090,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
@@ -1129,14 +1109,13 @@
main.step( "Add a flow with a SCTP selector" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
# Add a flow that connects host1 on port1 to host2 on port2
egress = 2
@@ -1186,12 +1165,6 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully sent a packet",
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.topo b/TestON/tests/FUNC/FUNCflow/FUNCflow.topo
index 41c97e3..6959073 100755
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.topo
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.topo
@@ -36,7 +36,7 @@
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
- <type>ScapyCliDriver</type>
+ <type>MininetScapyCliDriver</type>
<connect_order>3</connect_order>
<COMPONENTS>
<prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCformCluster/FUNCformCluster.params b/TestON/tests/FUNC/FUNCformCluster/FUNCformCluster.params
index b8da936..be399f6 100644
--- a/TestON/tests/FUNC/FUNCformCluster/FUNCformCluster.params
+++ b/TestON/tests/FUNC/FUNCformCluster/FUNCformCluster.params
@@ -14,7 +14,7 @@
<file>formClusterFuncs</file>
</DEPENDENCY>
<GRAPH>
- <nodeCluster>BM</nodeCluster>
+ <nodeCluster>VM</nodeCluster>
<builds>20</builds>
</GRAPH>
<ENV>
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
index 90a5082..99a8e01 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
@@ -3,14 +3,15 @@
# CASE - Description
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - install ONOS
- # 3 - Start mininet and verify topology
+ # 3 - Start mininet and scapy and verify topology
# 4 - Testing Scapy
# 5 - Testing GROUP with type "ALL"
# 6 - Deleting the Group and Flow
# 7 - Testing GROUP with type "INDIRECT"
# 8 - Deleting the group and flow
+ # 10 - Stop mininet and scapy
# 100 - Check logs for Errors and Warnings
- <testcases>1,2,3,5,6,7,6,100</testcases>
+ <testcases>1,2,3,5,6,7,6,10,100</testcases>
<GRAPH>
<nodeCluster>VM</nodeCluster>
@@ -68,4 +69,8 @@
<delGroup>10</delGroup>
</SLEEP>
+ <SCAPY>
+ <HOSTNAMES>h1,h2,h3,h4</HOSTNAMES>
+ </SCAPY>
+
</PARAMS>
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
index 8e06747..bbe759d 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
@@ -73,6 +73,8 @@
groupId = main.params[ 'TEST' ][ 'groupId' ]
priority = main.params[ 'TEST' ][ 'priority' ]
deviceId = main.params[ 'TEST' ][ 'swDPID' ]
+ main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
+ main.scapyHosts = [] # List of scapy hosts for iterating
main.debug = True if "on" in main.debug else False
# -- INIT SECTION, ONLY RUNS ONCE -- #
@@ -110,7 +112,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster )
+ main.testSetUp.ONOSSetUp( main.Cluster )
def CASE3( self, main ):
"""
@@ -153,17 +155,33 @@
main.topoRelated.compareTopos( main.Mininet1 )
+ main.step( "Create hosts and start scapy" )
+ scapyResult = main.TRUE
+ for hostName in main.scapyHostNames:
+ main.Scapy.createHostComponent( hostName )
+ main.scapyHosts.append( getattr( main, hostName ) )
+
+ main.step( "Start scapy components" )
+ for host in main.scapyHosts:
+ host.startHostCli()
+ host.startScapy()
+ host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully created Scapy Components",
+ onfail="Failed to discover Scapy Components" )
+
def CASE4( self, main ):
"""
Testing scapy
"""
main.case( "Testing scapy" )
- main.step( "Creating Host1 component" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
main.log.debug( host.name )
@@ -218,12 +236,6 @@
onpass="Pass",
onfail="Fail" )
- main.step( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
def CASE5( self, main ):
"""
Adding Group of type "ALL" using Rest api
@@ -307,17 +319,14 @@
Sends a packet using scapy
"""
main.step( "Testing Group by sending packet using Scapy" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
- main.Scapy.createHostComponent( "h3" )
- main.Scapy.createHostComponent( "h4" )
-
- hosts = [ main.h1, main.h2, main.h3, main.h4 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
main.log.info( "Constructing Packet" )
main.h1.buildEther( dst=main.h1.hostMac )
main.h1.buildIP( dst=main.h1.hostIp )
@@ -354,14 +363,6 @@
main.log.info( "Failure!!!Packet sent to port 1 is not received at port 2,3 and 4" )
stepResult = main.FALSE
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
- main.Mininet1.removeHostComponent( "h3" )
- main.Mininet1.removeHostComponent( "h4" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Packet sent to port 1 is received at port 2,3,4 ",
@@ -489,15 +490,14 @@
Sends a packet using scapy
"""
main.step( "Testing Group by sending packet using Scapy" )
- main.log.info( "Creating host components" )
- main.Scapy.createHostComponent( "h1" )
- main.Scapy.createHostComponent( "h2" )
-
- hosts = [ main.h1, main.h2 ]
- for host in hosts:
- host.startHostCli()
+ for host in main.scapyHosts:
+ host.stopScapy()
host.startScapy()
host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
main.log.info( "Constructing Packet" )
main.h1.buildEther( dst=main.h1.hostMac )
main.h1.buildIP( dst=main.h1.hostIp )
@@ -513,17 +513,50 @@
else:
main.h2.killFilter()
- main.log.info( "Clean up host components" )
- for host in hosts:
- host.stopScapy()
- main.Mininet1.removeHostComponent( "h1" )
- main.Mininet1.removeHostComponent( "h2" )
-
utilities.assert_equals( expect=main.TRUE,
actual=stepResultH2,
onpass="Packet sent to port 1 is received at port 2 successfully!!!",
onfail="Failure!!!Packet sent to port 1 is not received at port 2" )
+ def CASE10( self, main ):
+ """
+ Stop mininet and remove scapy host
+ """
+ try:
+ from tests.dependencies.utils import Utils
+ except ImportError:
+ main.log.error( "Utils not found exiting the test" )
+ main.cleanAndExit()
+ try:
+ main.Utils
+ except ( NameError, AttributeError ):
+ main.Utils = Utils()
+ main.log.report( "Stop Mininet and Scapy" )
+ main.case( "Stop Mininet and Scapy" )
+ main.caseExplanation = "Stopping the current mininet topology " +\
+ "to start up fresh"
+ main.step( "Stopping and Removing Scapy Host Components" )
+ scapyResult = main.TRUE
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and host.stopScapy()
+ main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
+
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and main.Scapy.removeHostComponent( host.name )
+ main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
+
+ main.scapyHosts = []
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully stopped scapy and removed host components",
+ onfail="Failed to stop mininet and scapy" )
+
+ mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
+ # Exit if topology did not load properly
+ if not ( mininetResult and scapyResult ):
+ main.cleanAndExit()
+
def CASE100( self, main ):
"""
Report errors/warnings/exceptions
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo
index 41c97e3..6959073 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo
@@ -36,7 +36,7 @@
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
- <type>ScapyCliDriver</type>
+ <type>MininetScapyCliDriver</type>
<connect_order>3</connect_order>
<COMPONENTS>
<prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 24d2f75..4f6b715 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -47,6 +47,9 @@
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
+ from tests.dependencies.Network import Network
+ main.Network = Network()
+
# Test variables
try:
main.apps = main.params[ 'ENV' ][ 'cellApps' ]
@@ -89,11 +92,12 @@
wrapperFile2 +
".py" )
- copyResult1 = main.ONOSbench.scp( main.Mininet1,
- main.dependencyPath +
- main.topology,
- main.Mininet1.home + "custom/",
- direction="to" )
+ if hasattr( main, "Mininet1" ):
+ copyResult1 = main.ONOSbench.scp( main.Mininet1,
+ main.dependencyPath +
+ main.topology,
+ main.Mininet1.home + "custom/",
+ direction="to" )
stepResult = main.testSetUp.envSetup()
except Exception as e:
@@ -113,7 +117,7 @@
- Connect to cli
"""
main.flowCompiler = "Flow Rules"
- main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
+ main.initialized = main.testSetUp.ONOSSetUp( main.Cluster, True )
main.intents.report( main )
def CASE8( self, main ):
@@ -148,8 +152,7 @@
main.step( "Starting Mininet topology with OF 1.0 switches" )
args = "--switch ovs,protocols=OpenFlow10"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
+ topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
args=args )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
@@ -178,8 +181,7 @@
main.step( "Starting Mininet topology with OF 1.3 switches" )
args = "--switch ovs,protocols=OpenFlow13"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
+ topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
args=args )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
@@ -212,7 +214,7 @@
tempONOSip = main.Cluster.getIps()
- assignResult = main.Mininet1.assignSwController( sw=switchList,
+ assignResult = main.Network.assignSwController( sw=switchList,
ip=tempONOSip,
port="6653" )
if not assignResult:
@@ -221,7 +223,7 @@
main.skipCase()
for i in range( 1, ( main.numSwitch + 1 ) ):
- response = main.Mininet1.getSwController( "s" + str( i ) )
+ response = main.Network.getSwController( "s" + str( i ) )
main.log.debug( "Response is " + str( response ) )
if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
assignResult = assignResult and main.TRUE
@@ -463,12 +465,6 @@
# if you want to use the wrapper function
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " +
@@ -757,12 +753,6 @@
# if you want to use the wrapper function
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " +
@@ -1254,12 +1244,6 @@
main.skipCase()
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " +
@@ -1550,12 +1534,6 @@
main.skipCase()
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " +
@@ -1875,12 +1853,6 @@
main.skipCase()
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " +
@@ -1892,7 +1864,7 @@
main.step( "Testing host mobility by moving h1 from s5 to s6" )
main.log.info( "Moving h1 from s5 to s6" )
- main.Mininet1.moveHost( "h1", "s5", "s6" )
+ main.Network.moveHost( "h1", "s5", "s6" )
# Send discovery ping from moved host
# Moving the host brings down the default interfaces and creates a new one.
@@ -1957,12 +1929,6 @@
main.skipCase()
assert main, "There is no main"
try:
- assert main.Mininet1
- except AssertionError:
- main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
- main.initialized = main.FALSE
- main.skipCase()
- try:
assert main.numSwitch
except AssertionError:
main.log.error( "Place the total number of switch topology in " + main.numSwitch )
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.topo b/TestON/tests/FUNC/FUNCintent/FUNCintent.topo
index ff5eccd..b5e4f03 100755
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.topo
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.topo
@@ -37,7 +37,7 @@
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
- <type>ScapyCliDriver</type>
+ <type>MininetScapyCliDriver</type>
<connect_order>3</connect_order>
<COMPONENTS>
<prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 1a7002b..0fcd334 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -743,7 +743,7 @@
checkFlowsState( main )
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1, host2, 10 )
+ iperfTemp = main.Network.iperftcp( host1, host2, 10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Initial Iperf Passed\n'
@@ -773,7 +773,7 @@
main.assertReturnString += 'Link Down Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1, host2, 10 )
+ iperfTemp = main.Network.iperftcp( host1, host2, 10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Down Iperf Passed\n'
@@ -822,7 +822,7 @@
main.assertReturnString += 'Link Up Topology State Failed\n'
# Run iperf to both host
- iperfTemp = main.Mininet1.iperftcp( host1, host2, 10 )
+ iperfTemp = main.Network.iperftcp( host1, host2, 10 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
main.assertReturnString += 'Link Up Iperf Passed\n'
@@ -1904,7 +1904,7 @@
Ping all host in the hosts list variable
"""
main.log.info( "Pinging: " + str( hostList ) )
- return main.Mininet1.pingallHosts( hostList )
+ return main.Network.pingallHosts( hostList )
def fwdPingall( main ):
@@ -1928,7 +1928,7 @@
# Send pingall in mininet
main.log.info( "Run Pingall" )
- pingResult = main.Mininet1.pingall( timeout=600 )
+ pingResult = main.Network.pingall( timeout=600 )
main.log.info( "Deactivating reactive forwarding app " )
deactivateResult = main.Cluster.active( 0 ).CLI.deactivateApp( "org.onosproject.fwd" )
@@ -2025,12 +2025,12 @@
import json
try:
hostsJson = json.loads( main.Cluster.active( 0 ).CLI.hosts() )
- hosts = main.Mininet1.getHosts().keys()
+ hosts = main.Network.getHosts().keys()
# TODO: Make better use of new getHosts function
for host in hosts:
main.hostsData[ host ] = {}
main.hostsData[ host ][ 'mac' ] = \
- main.Mininet1.getMacAddress( host ).upper()
+ main.Network.getMacAddress( host ).upper()
for hostj in hostsJson:
if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
@@ -2116,7 +2116,7 @@
# link down
main.log.info( itemName + ": Bring link " + option + " between " +
sw1 + " and " + sw2 )
- linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
+ linkResult = main.Network.link( end1=sw1, end2=sw2, option=option )
return linkResult
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index cbf1fea..dda829e 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -112,7 +112,7 @@
- Connect to cli
"""
main.flowCompiler = "Flow Rules"
- main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
+ main.initialized = main.testSetUp.ONOSSetUp( main.Cluster, True )
main.intentFunction.report( main )
def CASE8( self, main ):
@@ -153,8 +153,7 @@
main.step( "Starting Mininet topology with OF 1.0 switches" )
args = "--switch ovs,protocols=OpenFlow10"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
+ topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
args=args )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
@@ -181,8 +180,7 @@
main.step( "Starting Mininet topology with OF 1.3 switches" )
args = "--switch ovs,protocols=OpenFlow13"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
+ topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
args=args )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
index 33bcf52..9f36491 100755
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.topo
@@ -37,7 +37,7 @@
<host>OCN</host>
<user>sdn</user>
<password>rocks</password>
- <type>ScapyCliDriver</type>
+ <type>MininetScapyCliDriver</type>
<connect_order>3</connect_order>
<COMPONENTS>
<prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
index 4488458..df19aed 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -77,7 +77,7 @@
copyResult1 = main.ONOSbench.scp( main.Mininet1,
main.dependencyPath +
main.topology,
- main.Mininet1.home,
+ main.Mininet1.home + "custom/",
direction="to" )
stepResult = main.testSetUp.envSetup()
except Exception as e:
@@ -98,7 +98,7 @@
"""
import time
- main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
+ main.initialized = main.testSetUp.ONOSSetUp( main.Cluster, True )
main.step( "Checking that ONOS is ready" )
@@ -137,8 +137,7 @@
main.step( "Starting Mininet topology with OF 1.3 switches" )
args = "--switch ovs,protocols=OpenFlow13"
- topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
- main.topology,
+ topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "custom/" + main.topology,
args=args )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
index c168ea7..8ea053c 100755
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
@@ -28,10 +28,10 @@
<type>MininetCliDriver</type>
<connect_order>2</connect_order>
<COMPONENTS>
- <home>~/mininet/custom/</home>
+ <home>~/mininet/</home>
<prompt></prompt>
</COMPONENTS>
</Mininet1>
</COMPONENT>
-</TOPOLOGY>
\ No newline at end of file
+</TOPOLOGY>
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index cb80126..733d5e5 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -83,7 +83,7 @@
- Connect to cli
"""
import time
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster )
+ main.testSetUp.ONOSSetUp( main.Cluster )
def CASE8( self, main ):
"""
@@ -685,12 +685,18 @@
subjectKey="of:0000000000000005",
configKey="basic" )
+ # Wait 5 secs after set up netCfg
+ time.sleep( main.SetNetCfgSleep )
+
s6Json = main.s6Json
setS1 = main.Cluster.active( 0 ).REST.setNetCfg( s6Json,
subjectClass="devices",
subjectKey="of:0000000000000006",
configKey="basic" )
+ # Wait 5 secs after set up netCfg
+ time.sleep( main.SetNetCfgSleep )
+
def CASE27( self, main ):
"""
1 ) A = get /network/configuration
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index ad2c4ba..566cb2b 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -105,7 +105,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
+ main.testSetUp.ONOSSetUp( main.Cluster, True )
def CASE19( self, main ):
"""
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index aa298ab..db9f217 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
@@ -83,7 +83,7 @@
- Connect to cli
"""
main.flowCompiler = "Flow Rules"
- main.testSetUp.ONOSSetUp( main.LincOE, main.Cluster, True )
+ main.testSetUp.ONOSSetUp( main.Cluster, True, mininetIp=main.LincOE )
def CASE10( self, main ):
"""
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
index 6b6ad93..fd5c9a7 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
@@ -78,8 +78,8 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- cliResults = main.testSetUp.ONOSSetUp( main.OVSDB1, main.Cluster,
- cellName=cellName, removeLog=True )
+ cliResults = main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName,
+ mininetIp=main.OVSDB1, removeLog=True )
if cliResults == main.FALSE:
main.log.error( "Failed to start ONOS, stopping test" )
diff --git a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
index 73e7f4a..2cb3832 100644
--- a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
@@ -86,7 +86,7 @@
main.maxNodes = 1
- cliResults = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
+ cliResults = main.testSetUp.ONOSSetUp( main.Cluster,
cellName=cellName, removeLog=True )
if cliResults == main.FALSE:
main.log.error( "Failed to start ONOS, stopping test" )
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
index d7c4cab..bbf11ae 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
@@ -33,7 +33,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>drivers,openflow,proxyarp,mobility,events</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index 96ba015..96e49c2 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -65,9 +65,6 @@
start cli sessions
start tcpdump
"""
- import imp
- import time
- import json
main.log.info( "ONOS HA test: Restart all ONOS nodes - " +
"initialization" )
# These are for csv plotting in jenkins
@@ -91,7 +88,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=main.HA.startingMininet )
main.HA.initialSetUp()
@@ -143,12 +140,6 @@
except ( NameError, AttributeError ):
main.log.error( "main.HAdata not defined, setting to []" )
main.HAdata = []
- # Reset non-persistent variables
- try:
- iCounterValue = 0
- except NameError:
- main.log.error( "iCounterValue not defined, setting to 0" )
- iCounterValue = 0
main.case( "Restart entire ONOS cluster" )
@@ -216,7 +207,7 @@
" error logs" )
leaderResult = main.FALSE
elif leaderN is None:
- main.log.error( cli.name +
+ main.log.error( ctrl.name +
" shows no leader for the election-app." )
leaderResult = main.FALSE
if len( set( leaderList ) ) != 1:
diff --git a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.params b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.params
index f1520f7..3d96b4c 100644
--- a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.params
+++ b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.params
@@ -19,7 +19,12 @@
#CASE15: Check that Leadership Election is still functional
#CASE16: Install Distributed Primitives app
#CASE17: Check for basic functionality with distributed primitives
- <testcases>1,2,8,21,3,4,5,14,16,17,[61,8,7,4,15,17,62]*1000,8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+ <testcases>1,2,8,21,3,4,5,14,16,17,[61,8,7,4,15,17,62,7,8,4,15,17]*1000,8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
<apps></apps>
<ONOS_Configuration>
@@ -30,7 +35,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>drivers,openflow,proxyarp,mobility,events</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
index 8238b94..8438780 100644
--- a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
+++ b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
@@ -66,10 +66,6 @@
start cli sessions
start tcpdump
"""
- import imp
- import pexpect
- import time
- import json
main.log.info( "ONOS HA test: Stop a minority of ONOS nodes - " +
"initialization" )
# set global variables
@@ -95,7 +91,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.startingMininet,
main.HA.customizeOnosGenPartitions ],
extraClean=main.HA.cleanUpGenPartition )
@@ -140,9 +136,9 @@
try:
assert main.nodeIndex is not None, "main.nodeIndex not defined"
assert main.killCount is not None, "main.killCount not defined"
- except AttributeError as e:
+ except AttributeError:
main.log.warn( "Node to kill not selected, defaulting to node 1" )
- main.nodeIndex = 0
+ main.nodeIndex = -1
main.killCount = 1
main.case( "Stopping ONOS nodes - iteration " + str( main.killCount ) )
@@ -168,6 +164,7 @@
utilities.assert_equals( expect=main.TRUE, actual=killResults,
onpass="ONOS nodes stopped successfully",
onfail="ONOS nodes NOT successfully stopped" )
+ main.Cluster.reset()
main.step( "Checking ONOS nodes" )
nodeResults = utilities.retry( main.Cluster.nodesCheck,
@@ -193,7 +190,7 @@
"""
The bring up stopped nodes
"""
- main.HA.bringUpStoppedNode( main )
+ main.HA.bringUpStoppedNodes( main )
def CASE7( self, main ):
"""
@@ -210,9 +207,6 @@
# Test of LeadershipElection
leaderList = []
- restarted = []
- for ctrl in main.kill:
- restarted.append( ctrl.ipAddress )
leaderResult = main.TRUE
for ctrl in main.Cluster.active():
@@ -229,11 +223,6 @@
" shows no leader for the election-app was" +
" elected after the old one died" )
leaderResult = main.FALSE
- elif leaderN in restarted:
- main.log.error( ctrl.name + " shows " + str( leaderN ) +
- " as leader for the election-app, but it " +
- "was restarted" )
- leaderResult = main.FALSE
if len( set( leaderList ) ) != 1:
leaderResult = main.FALSE
main.log.error(
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
index 6dcfb5b..fe4cd80 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
@@ -35,7 +35,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>drivers,openflow,proxyarp,mobility,events</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 13424ed..d3bb153 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -66,10 +66,6 @@
start cli sessions
start tcpdump
"""
- import imp
- import pexpect
- import time
- import json
main.log.info( "ONOS HA test: Partition ONOS nodes into two sub-clusters - " +
"initialization" )
# set global variables
@@ -94,7 +90,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.startingMininet,
main.HA.customizeOnosGenPartitions ],
extraClean=main.HA.cleanUpGenPartition )
@@ -134,7 +130,8 @@
"""
The Failure case.
"""
- import math
+ import pexpect
+ import time
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
main.case( "Partition ONOS nodes into two distinct partitions" )
@@ -163,37 +160,43 @@
if i not in main.partition:
for j in main.partition:
foe = main.Cluster.runningNodes[ j ]
- main.log.warn( "Setting IP Tables rule from {} to {}. ".format( iCtrl.ipAddress, foe.ipAddress ) )
+ main.log.warn( "Setting IP Tables rule from {} to {}. ".format( iCtrl.ipAddress,
+ foe.ipAddress ) )
# CMD HERE
try:
- cmdStr = "sudo iptables -A {} -d {} -s {} -j DROP".format( "INPUT", iCtrl.ipAddress, foe.ipAddress )
+ cmdStr = "sudo iptables -A {} -d {} -s {} -j DROP".format( "INPUT",
+ iCtrl.ipAddress,
+ foe.ipAddress )
this.sendline( cmdStr )
this.expect( "\$" )
main.log.debug( this.before )
except pexpect.EOF:
- main.log.error( self.name + ": EOF exception found" )
- main.log.error( self.name + ": " + self.handle.before )
+ main.log.error( iCtrl.name + ": EOF exception found" )
+ main.log.error( iCtrl.name + ": " + this.before )
main.cleanAndExit()
except Exception:
- main.log.exception( self.name + ": Uncaught exception!" )
+ main.log.exception( iCtrl.name + ": Uncaught exception!" )
main.cleanAndExit()
else:
for j in range( 0, n ):
if j not in main.partition:
foe = main.Cluster.runningNodes[ j ]
- main.log.warn( "Setting IP Tables rule from {} to {}. ".format( iCtrl.ipAddress, foe.ipAddress ) )
+ main.log.warn( "Setting IP Tables rule from {} to {}. ".format( iCtrl.ipAddress,
+ foe.ipAddress ) )
# CMD HERE
- cmdStr = "sudo iptables -A {} -d {} -s {} -j DROP".format( "INPUT", iCtrl.ipAddress, foe.ipAddress )
+ cmdStr = "sudo iptables -A {} -d {} -s {} -j DROP".format( "INPUT",
+ iCtrl.ipAddress,
+ foe.ipAddress )
try:
this.sendline( cmdStr )
this.expect( "\$" )
main.log.debug( this.before )
except pexpect.EOF:
- main.log.error( self.name + ": EOF exception found" )
- main.log.error( self.name + ": " + self.handle.before )
+ main.log.error( iCtrl.name + ": EOF exception found" )
+ main.log.error( iCtrl.name + ": " + this.before )
main.cleanAndExit()
except Exception:
- main.log.exception( self.name + ": Uncaught exception!" )
+ main.log.exception( iCtrl.name + ": Uncaught exception!" )
main.cleanAndExit()
main.Cluster.runningNodes[ i ].active = False
iCtrl.Bench.exitFromSsh( this, iCtrl.ipAddress )
@@ -210,7 +213,6 @@
"""
Healing Partition
"""
- import time
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
assert main.partition, "main.partition not defined"
@@ -232,21 +234,11 @@
for node in main.partition:
main.Cluster.runningNodes[ node ].active = True
- """
- # NOTE : Not sure if this can be removed
- main.activeNodes.sort()
- try:
- assert list( set( main.activeNodes ) ) == main.activeNodes,\
- "List of active nodes has duplicates, this likely indicates something was run out of order"
- except AssertionError:
- main.log.exception( "" )
- main.cleanAndExit()
- """
main.step( "Checking ONOS nodes" )
nodeResults = utilities.retry( main.Cluster.nodesCheck,
False,
sleep=15,
- attempts=5 )
+ attempts=50 )
utilities.assert_equals( expect=True, actual=nodeResults,
onpass="Nodes check successful",
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.params b/TestON/tests/HA/HAkillNodes/HAkillNodes.params
index b9ed44a..409bd1f 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.params
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.params
@@ -35,7 +35,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>drivers,openflow,proxyarp,mobility,events</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index 1c82e88..5676d3c 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -88,7 +88,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.startingMininet,
main.HA.customizeOnosGenPartitions,
main.HA.copyBackupConfig,
@@ -181,7 +181,7 @@
"""
The bring up stopped nodes
"""
- main.HA.bringUpStoppedNode( main )
+ main.HA.bringUpStoppedNodes( main )
def CASE7( self, main ):
"""
diff --git a/TestON/tests/HA/HAsanity/HAsanity.params b/TestON/tests/HA/HAsanity/HAsanity.params
index d9e4627..5a9f8f9 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.params
+++ b/TestON/tests/HA/HAsanity/HAsanity.params
@@ -34,7 +34,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>events,drivers,openflow,proxyarp,mobility</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index eb90c53..2773ac6 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -87,7 +87,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=main.HA.startingMininet )
main.HA.initialSetUp()
@@ -168,7 +168,7 @@
" error logs" )
leaderResult = main.FALSE
elif leaderN is None:
- main.log.error( cli.name +
+ main.log.error( ctrl.name +
" shows no leader for the election-app was" +
" elected after the old one died" )
leaderResult = main.FALSE
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index d4b7b32..93e65c9 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -65,9 +65,6 @@
start cli sessions
start tcpdump
"""
- import time
- import os
- import re
main.log.info( "ONOS HA test: Restart all ONOS nodes - " +
"initialization" )
# set global variables
@@ -81,6 +78,7 @@
main.log.error( "ONOSSetup not found. exiting the test" )
main.cleanAndExit()
main.testSetUp.envSetupDescription()
+ main.Cluster.numCtrls = 1
try:
from tests.HA.dependencies.HA import HA
main.HA = HA()
@@ -95,7 +93,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.setServerForCluster,
main.HA.scalingMetadata,
main.HA.startingMininet,
@@ -175,7 +173,7 @@
else:
equal = False
main.Cluster.setRunningNode( int( re.search( "\d+", scale ).group( 0 ) ) )
- main.log.info( "Scaling to {} nodes".format( main.Cluster.numCtrls ) )
+ main.step( "Scaling to {} nodes".format( main.Cluster.numCtrls ) )
genResult = main.Server.generateFile( main.Cluster.numCtrls, equal=equal )
utilities.assert_equals( expect=main.TRUE, actual=genResult,
onpass="New cluster metadata file generated",
@@ -260,7 +258,7 @@
" error logs" )
leaderResult = main.FALSE
elif leaderN is None:
- main.log.error( cli.name +
+ main.log.error( ctrl.name +
" shows no leader for the election-app." )
leaderResult = main.FALSE
if len( set( leaderList ) ) != 1:
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 74b2fc1..90ff577 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -65,9 +65,6 @@
start cli sessions
start tcpdump
"""
- import imp
- import time
- import json
main.log.info( "ONOS Single node cluster restart " +
"HA test - initialization" )
main.case( "Setting up test environment" )
@@ -99,13 +96,13 @@
main.testSetUp.evnSetupConclusion( stepResult )
main.Cluster.setRunningNode( int( main.params[ 'num_controllers' ] ) )
ip = main.Cluster.getIps( allNode=True )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName="SingleHA", removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName="SingleHA", removeLog=True,
extraApply=[ main.testSetUp.createApplyCell,
main.HA.startingMininet,
main.testSetUp.createApplyCell ],
- applyArgs=[ [ main.Cluster, True, cellName, main.Mininet1, True, ip ],
+ applyArgs=[ [ main.Cluster, True, cellName, "", "localhost", True, ip ],
None,
- [ main.Cluster, True, "SingleHA", main.Mininet1,
+ [ main.Cluster, True, "SingleHA", "", "localhost",
True, main.Cluster.runningNodes[ 0 ].ipAddress ] ] )
main.HA.initialSetUp()
@@ -167,6 +164,11 @@
main.log.warn( "ONOS1 intents response: " + repr( ONOSIntents ) )
else:
intentCheck = main.TRUE
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=intentCheck,
+ onpass="Intents are consistent across all ONOS nodes",
+ onfail="ONOS nodes have different views of intents" )
main.step( "Get the flows from each controller" )
global flowState
@@ -227,9 +229,6 @@
main.log.exception( "Error parsing clusters[0]: " +
repr( clusters[ 0 ] ) )
numClusters = "ERROR"
- clusterResults = main.FALSE
- if numClusters == 1:
- clusterResults = main.TRUE
utilities.assert_equals(
expect=1,
actual=numClusters,
@@ -322,13 +321,6 @@
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
- # Reset non-persistent variables
- try:
- iCounterValue = 0
- except NameError:
- main.log.error( "iCounterValue not defined, setting to 0" )
- iCounterValue = 0
-
main.case( "Restart ONOS node" )
main.caseExplanation = "Killing ONOS process and restart cli " +\
"sessions once onos is up."
@@ -556,7 +548,7 @@
mnSwitches,
json.loads( devices[ controller ] ),
json.loads( ports[ controller ] ) )
- except ( TypeError, ValueError ) as e:
+ except ( TypeError, ValueError ):
main.log.exception( "Object not as expected; devices={!r}\nports={!r}".format(
devices[ controller ], ports[ controller ] ) )
else:
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.params b/TestON/tests/HA/HAstopNodes/HAstopNodes.params
index b9ed44a..de7f775 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.params
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.params
@@ -35,7 +35,7 @@
</ONOS_Configuration>
<ENV>
<cellName>HA</cellName>
- <appString>drivers,openflow,proxyarp,mobility</appString>
+ <appString>events,drivers,openflow,proxyarp,mobility</appString>
</ENV>
<GIT>
<pull>False</pull>
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index 2884535..815ab52 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -88,7 +88,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.startingMininet,
main.HA.customizeOnosGenPartitions,
main.HA.copyBackupConfig ],
@@ -180,7 +180,7 @@
"""
The bring up stopped nodes
"""
- main.HA.bringUpStoppedNode( main )
+ main.HA.bringUpStoppedNodes( main )
def CASE7( self, main ):
"""
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index b221347..05989fd 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -65,9 +65,6 @@
start cli sessions
start tcpdump
"""
- import time
- import os
- import re
main.log.info( "ONOS HA test: Restart all ONOS nodes - " +
"initialization" )
# set global variables
@@ -94,7 +91,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, cellName=cellName, removeLog=True,
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
extraApply=[ main.HA.setServerForCluster,
main.HA.swapNodeMetadata,
main.HA.startingMininet,
@@ -139,7 +136,6 @@
The Scaling case.
"""
import time
- import re
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
try:
diff --git a/TestON/tests/HA/HAupgrade/HAupgrade.params b/TestON/tests/HA/HAupgrade/HAupgrade.params
new file mode 100644
index 0000000..ba5d077
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/HAupgrade.params
@@ -0,0 +1,98 @@
+<PARAMS>
+ #List of test cases:
+ #CASE1: Compile ONOS and push it to the test machines
+ #CASE2: Assign devices to controllers
+ #CASE21: Assign mastership to controllers
+ #CASE3: Assign intents
+ #CASE4: Ping across added host intents
+ #CASE5: Reading state of ONOS
+ #CASE61: The Failure inducing case.
+ #CASE62: The Failure recovery case.
+ #CASE7: Check state after control plane failure
+ #CASE8: Compare topo
+ #CASE9: Link s3-s28 down
+ #CASE10: Link s3-s28 up
+ #CASE11: Switch down
+ #CASE12: Switch up
+ #CASE13: Clean up
+ #CASE14: start election app on all onos nodes
+ #CASE15: Check that Leadership Election is still functional
+ #CASE16: Install Distributed Primitives app
+ #CASE17: Check for basic functionality with distributed primitives
+ <testcases>1,2,8,21,[3,4,5,14,16,17]*1,[60,8,61,8,62,8,63,8,64,8,7,4,15,17],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <apps></apps>
+ <ONOS_Configuration>
+ <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+ <useFlowObjectives>false</useFlowObjectives>
+ <defaultFlowObjectiveCompiler>org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler</defaultFlowObjectiveCompiler>
+ </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+ </ONOS_Configuration>
+ <ENV>
+ <cellName>HA</cellName>
+ <appString>drivers,openflow,proxyarp,mobility</appString>
+ </ENV>
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+ <num_controllers> 7 </num_controllers>
+ <tcpdump> False </tcpdump>
+
+ <CTRL>
+ <port1>6653</port1>
+ <port2>6653</port2>
+ <port3>6653</port3>
+ <port4>6653</port4>
+ <port5>6653</port5>
+ <port6>6653</port6>
+ <port7>6653</port7>
+ </CTRL>
+ <BACKUP>
+ <ENABLED> False </ENABLED>
+ <TESTONUSER>sdn</TESTONUSER>
+ <TESTONIP>10.128.30.9</TESTONIP>
+ </BACKUP>
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ <gossip>5</gossip>
+ </timers>
+ <kill>
+ <switch> s5 </switch>
+ <dpid> 0000000000005000 </dpid>
+ <links> h5 s2 s1 s6 </links>
+ </kill>
+ <MNtcpdump>
+ <intf>eth0</intf>
+ <port> </port>
+ <folder>~/packet_captures/</folder>
+ </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HA/HAupgrade/HAupgrade.py b/TestON/tests/HA/HAupgrade/HAupgrade.py
new file mode 100644
index 0000000..2254bc3
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/HAupgrade.py
@@ -0,0 +1,362 @@
+"""
+Copyright 2015 Open Networking Foundation (ONF)
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+"""
+Description: This test is to determine if ONOS can handle
+ a minority of it's nodes restarting
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE61: The Failure inducing case.
+CASE62: The Failure recovery case.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+CASE16: Install Distributed Primitives app
+CASE17: Check for basic functionality with distributed primitives
+"""
+class HAupgrade:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ CASE1 is to compile ONOS and push it to the test machines
+
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ NOTE: temporary - onos-remove-raft-logs
+ onos-uninstall
+ start mininet
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ start cli sessions
+ start tcpdump
+ """
+ main.log.info( "ONOS HA test: Stop a minority of ONOS nodes - " +
+ "initialization" )
+ # These are for csv plotting in jenkins
+ main.HAlabels = []
+ main.HAdata = []
+ try:
+ from tests.dependencies.ONOSSetup import ONOSSetup
+ main.testSetUp = ONOSSetup()
+ except ImportError:
+ main.log.error( "ONOSSetup not found. exiting the test" )
+ main.cleanAndExit()
+ main.testSetUp.envSetupDescription()
+ try:
+ from tests.HA.dependencies.HA import HA
+ main.HA = HA()
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.apps = main.params[ 'ENV' ][ 'appString' ]
+ stepResult = main.testSetUp.envSetup()
+ except Exception as e:
+ main.testSetUp.envSetupException( e )
+ main.testSetUp.evnSetupConclusion( stepResult )
+ main.HA.generateGraph( "HAupgrade" )
+
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
+ extraApply=[ main.HA.startingMininet,
+ main.HA.copyBackupConfig ],
+ extraClean=main.HA.cleanUpGenPartition )
+
+ main.HA.initialSetUp( serviceClean=True )
+
+ def CASE2( self, main ):
+ """
+ Assign devices to controllers
+ """
+ main.HA.assignDevices( main )
+
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ main.HA.assignMastership( main )
+
+ def CASE3( self, main ):
+ """
+ Assign intents
+ """
+ main.HA.assignIntents( main )
+
+ def CASE4( self, main ):
+ """
+ Ping across added host intents
+ """
+ main.HA.pingAcrossHostIntent( main )
+
+ def CASE5( self, main ):
+ """
+ Reading state of ONOS
+ """
+ main.HA.readingState( main )
+
+ def CASE60( self, main ):
+ """
+ Initialize the upgrade.
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Initialize upgrade" )
+ main.HA.upgradeInit( main )
+
+ def CASE61( self, main ):
+ """
+ Upgrade a minority of nodes PHASE 1
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Upgrade minority of ONOS nodes" )
+
+ main.step( "Checking ONOS Logs for errors" )
+ for ctrl in main.Cluster.active():
+ main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
+ main.log.warn( ctrl.checkLogs( ctrl.ipAddress ) )
+
+ main.kill = []
+ n = len( main.Cluster.runningNodes ) # Number of nodes
+ p = n / 2 # Number of nodes in the minority
+ for i in range( p ):
+ main.kill.append( main.Cluster.runningNodes[ i ] ) # ONOS node to kill, listed by index in main.nodes
+ main.HA.upgradeNodes( main )
+
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ if not nodeResults:
+ for ctrl in main.Cluster.active():
+ main.log.debug( "{} components not ACTIVE: \n{}".format(
+ ctrl.name,
+ ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+ main.log.error( "Failed to start ONOS, stopping test" )
+ main.cleanAndExit()
+
+ def CASE62( self, main ):
+ """
+ Transfer to new version. PHASE 2
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Start the upgrade" )
+
+ main.step( "Send the command to switch to new version" )
+ ctrl = main.Cluster.next().CLI
+ upgraded = ctrl.issuUpgrade()
+ utilities.assert_equals( expect=main.TRUE, actual=upgraded,
+ onpass="Cluster has moved to the upgraded nodes",
+ onfail="Error transitioning to the upgraded nodes" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+ # TODO: check things here?
+
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ def CASE63( self, main ):
+ """
+ Upgrade the rest of the nodes
+ """
+ main.case( "Upgrade remaining nodes" )
+ upgraded = main.kill
+ main.kill = []
+ for node in main.Cluster.runningNodes:
+ if node not in upgraded:
+ main.kill.append( node )
+
+ main.HA.upgradeNodes( main )
+
+ def CASE64( self, main ):
+ """
+ Commit to the upgrade.
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Commit upgrade" )
+
+ main.step( "Send the command to commit the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ committed = ctrl.issuCommit()
+ utilities.assert_equals( expect=main.TRUE, actual=committed,
+ onpass="Upgrade has been committed",
+ onfail="Error committing the upgrade" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+ # TODO: check things here?
+
+ def CASE7( self, main ):
+ """
+ Check state after ONOS failure
+ """
+ try:
+ main.kill
+ except AttributeError:
+ main.kill = []
+
+ main.HA.checkStateAfterEvent( main, afterWhich=0 )
+ main.step( "Leadership Election is still functional" )
+ # Test of LeadershipElection
+ leaderList = []
+
+ restarted = []
+ for ctrl in main.kill:
+ restarted.append( ctrl.ipAddress )
+ leaderResult = main.TRUE
+
+ for ctrl in main.Cluster.active():
+ leaderN = ctrl.electionTestLeader()
+ leaderList.append( leaderN )
+ if leaderN == main.FALSE:
+ # error in response
+ main.log.error( "Something is wrong with " +
+ "electionTestLeader function, check the" +
+ " error logs" )
+ leaderResult = main.FALSE
+ elif leaderN is None:
+ main.log.error( ctrl.name +
+ " shows no leader for the election-app was" +
+ " elected after the old one died" )
+ leaderResult = main.FALSE
+ elif leaderN in restarted:
+ main.log.error( ctrl.name + " shows " + str( leaderN ) +
+ " as leader for the election-app, but it " +
+ "was restarted" )
+ leaderResult = main.FALSE
+ if len( set( leaderList ) ) != 1:
+ leaderResult = main.FALSE
+ main.log.error(
+ "Inconsistent view of leader for the election test app" )
+ # TODO: print the list
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=leaderResult,
+ onpass="Leadership election passed",
+ onfail="Something went wrong with Leadership election" )
+
+ def CASE8( self, main ):
+ """
+ Compare topo
+ """
+ main.HA.compareTopo( main )
+
+ def CASE9( self, main ):
+ """
+ Link s3-s28 down
+ """
+ main.HA.linkDown( main )
+
+ def CASE10( self, main ):
+ """
+ Link s3-s28 up
+ """
+ main.HA.linkUp( main )
+
+ def CASE11( self, main ):
+ """
+ Switch Down
+ """
+ # NOTE: You should probably run a topology check after this
+ main.HA.switchDown( main )
+
+ def CASE12( self, main ):
+ """
+ Switch Up
+ """
+ # NOTE: You should probably run a topology check after this
+ main.HA.switchUp( main )
+
+ def CASE13( self, main ):
+ """
+ Clean up
+ """
+ main.HAlabels.append( "Restart" )
+ main.HAdata.append( str( main.restartTime ) )
+ main.HA.cleanUp( main )
+
+ def CASE14( self, main ):
+ """
+ start election app on all onos nodes
+ """
+ main.HA.startElectionApp( main )
+
+ def CASE15( self, main ):
+ """
+ Check that Leadership Election is still functional
+ 15.1 Run election on each node
+ 15.2 Check that each node has the same leaders and candidates
+ 15.3 Find current leader and withdraw
+ 15.4 Check that a new node was elected leader
+ 15.5 Check that that new leader was the candidate of old leader
+ 15.6 Run for election on old leader
+ 15.7 Check that oldLeader is a candidate, and leader if only 1 node
+ 15.8 Make sure that the old leader was added to the candidate list
+
+ old and new variable prefixes refer to data from before vs after
+ withdrawl and later before withdrawl vs after re-election
+ """
+ main.HA.isElectionFunctional( main )
+
+ def CASE16( self, main ):
+ """
+ Install Distributed Primitives app
+ """
+ main.HA.installDistributedPrimitiveApp( main )
+
+ def CASE17( self, main ):
+ """
+ Check for basic functionality with distributed primitives
+ """
+ main.HA.checkDistPrimitivesFunc( main )
diff --git a/TestON/tests/HA/HAupgrade/HAupgrade.topo b/TestON/tests/HA/HAupgrade/HAupgrade.topo
new file mode 100644
index 0000000..4bf4bd4
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/HAupgrade.topo
@@ -0,0 +1,53 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></onos_home> # defines where onos home is
+ <nodes> 7 </nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/obelisk.py </arg1>
+ <arg2> --topo obelisk </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> none </controller>
+ <home>~/mininet/custom/</home>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet2>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HA/HAupgrade/README b/TestON/tests/HA/HAupgrade/README
new file mode 100644
index 0000000..b3ffbfa
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/README
@@ -0,0 +1,29 @@
+This test is designed to verify that an ONOS cluster behaves correctly when some
+ONOS nodes are upgrade. Then test will initilize the upgrade then stop, upgrade,
+and restart a minority of the nodes in the cluster. Then we will start the first
+phase of the upgrade process to transfer to the new version. Then we will upgrade
+and restart the rest of the cluster. After that the test will verify everything
+works and commit the upgrade.
+
+As written, the test only supports an ONOS cluster of 3, 5, or 7 nodes.
+This is because the test doesn't apply to a single node cluster and ONOS clusters
+should be deployed in odd numbers.
+
+The gerneral structure for the test:
+- Startup
+- Assign switches
+- Verify ONOS state and functionality
+ - Device mastership
+ - Intents
+ - Leadership election
+ - Distributed Primitives
+- Initialize an upgrade
+- Upgrade some ONOS nodes
+- Verify ONOS state and functionality
+- Transfer to new version
+- Upgrade the rest of the nodes
+- Verify ONOS state and functionality
+- Commit the upgrade
+- Dataplane failures
+ - link down and up
+ - switch down and up
diff --git a/TestON/tests/HA/HAupgrade/__init__.py b/TestON/tests/HA/HAupgrade/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/__init__.py
diff --git a/TestON/tests/HA/HAupgrade/dependencies/__init__.py b/TestON/tests/HA/HAupgrade/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HA/HAupgrade/dependencies/__init__.py
diff --git a/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.params b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.params
new file mode 100644
index 0000000..ba5d077
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.params
@@ -0,0 +1,98 @@
+<PARAMS>
+ #List of test cases:
+ #CASE1: Compile ONOS and push it to the test machines
+ #CASE2: Assign devices to controllers
+ #CASE21: Assign mastership to controllers
+ #CASE3: Assign intents
+ #CASE4: Ping across added host intents
+ #CASE5: Reading state of ONOS
+ #CASE61: The Failure inducing case.
+ #CASE62: The Failure recovery case.
+ #CASE7: Check state after control plane failure
+ #CASE8: Compare topo
+ #CASE9: Link s3-s28 down
+ #CASE10: Link s3-s28 up
+ #CASE11: Switch down
+ #CASE12: Switch up
+ #CASE13: Clean up
+ #CASE14: start election app on all onos nodes
+ #CASE15: Check that Leadership Election is still functional
+ #CASE16: Install Distributed Primitives app
+ #CASE17: Check for basic functionality with distributed primitives
+ <testcases>1,2,8,21,[3,4,5,14,16,17]*1,[60,8,61,8,62,8,63,8,64,8,7,4,15,17],8,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <apps></apps>
+ <ONOS_Configuration>
+ <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+ <useFlowObjectives>false</useFlowObjectives>
+ <defaultFlowObjectiveCompiler>org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler</defaultFlowObjectiveCompiler>
+ </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+ </ONOS_Configuration>
+ <ENV>
+ <cellName>HA</cellName>
+ <appString>drivers,openflow,proxyarp,mobility</appString>
+ </ENV>
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+ <num_controllers> 7 </num_controllers>
+ <tcpdump> False </tcpdump>
+
+ <CTRL>
+ <port1>6653</port1>
+ <port2>6653</port2>
+ <port3>6653</port3>
+ <port4>6653</port4>
+ <port5>6653</port5>
+ <port6>6653</port6>
+ <port7>6653</port7>
+ </CTRL>
+ <BACKUP>
+ <ENABLED> False </ENABLED>
+ <TESTONUSER>sdn</TESTONUSER>
+ <TESTONIP>10.128.30.9</TESTONIP>
+ </BACKUP>
+ <PING>
+ <source1>h8</source1>
+ <source2>h9</source2>
+ <source3>h10</source3>
+ <source4>h11</source4>
+ <source5>h12</source5>
+ <source6>h13</source6>
+ <source7>h14</source7>
+ <source8>h15</source8>
+ <source9>h16</source9>
+ <source10>h17</source10>
+ <target1>10.0.0.18</target1>
+ <target2>10.0.0.19</target2>
+ <target3>10.0.0.20</target3>
+ <target4>10.0.0.21</target4>
+ <target5>10.0.0.22</target5>
+ <target6>10.0.0.23</target6>
+ <target7>10.0.0.24</target7>
+ <target8>10.0.0.25</target8>
+ <target9>10.0.0.26</target9>
+ <target10>10.0.0.27</target10>
+ </PING>
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ <gossip>5</gossip>
+ </timers>
+ <kill>
+ <switch> s5 </switch>
+ <dpid> 0000000000005000 </dpid>
+ <links> h5 s2 s1 s6 </links>
+ </kill>
+ <MNtcpdump>
+ <intf>eth0</intf>
+ <port> </port>
+ <folder>~/packet_captures/</folder>
+ </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py
new file mode 100644
index 0000000..be68336
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py
@@ -0,0 +1,391 @@
+"""
+Copyright 2015 Open Networking Foundation (ONF)
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+"""
+Description: This test is to determine if ONOS can handle
+ a minority of it's nodes restarting
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign devices to controllers
+CASE21: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE61: The Failure inducing case.
+CASE62: The Failure recovery case.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+CASE16: Install Distributed Primitives app
+CASE17: Check for basic functionality with distributed primitives
+"""
+class HAupgradeRollback:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ CASE1 is to compile ONOS and push it to the test machines
+
+ Startup sequence:
+ cell <name>
+ onos-verify-cell
+ NOTE: temporary - onos-remove-raft-logs
+ onos-uninstall
+ start mininet
+ git pull
+ mvn clean install
+ onos-package
+ onos-install -f
+ onos-wait-for-start
+ start cli sessions
+ start tcpdump
+ """
+ main.log.info( "ONOS HA test: Stop a minority of ONOS nodes - " +
+ "initialization" )
+ # These are for csv plotting in jenkins
+ main.HAlabels = []
+ main.HAdata = []
+ try:
+ from tests.dependencies.ONOSSetup import ONOSSetup
+ main.testSetUp = ONOSSetup()
+ except ImportError:
+ main.log.error( "ONOSSetup not found. exiting the test" )
+ main.cleanAndExit()
+ main.testSetUp.envSetupDescription()
+ try:
+ from tests.HA.dependencies.HA import HA
+ main.HA = HA()
+ cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.apps = main.params[ 'ENV' ][ 'appString' ]
+ stepResult = main.testSetUp.envSetup()
+ except Exception as e:
+ main.testSetUp.envSetupException( e )
+ main.testSetUp.evnSetupConclusion( stepResult )
+ main.HA.generateGraph( "HAupgrade" )
+
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName, removeLog=True,
+ extraApply=[ main.HA.startingMininet,
+ main.HA.copyBackupConfig ],
+ extraClean=main.HA.cleanUpGenPartition )
+
+ main.HA.initialSetUp( serviceClean=True )
+
+ def CASE2( self, main ):
+ """
+ Assign devices to controllers
+ """
+ main.HA.assignDevices( main )
+
+ def CASE21( self, main ):
+ """
+ Assign mastership to controllers
+ """
+ main.HA.assignMastership( main )
+
+ def CASE3( self, main ):
+ """
+ Assign intents
+ """
+ main.HA.assignIntents( main )
+
+ def CASE4( self, main ):
+ """
+ Ping across added host intents
+ """
+ main.HA.pingAcrossHostIntent( main )
+
+ def CASE5( self, main ):
+ """
+ Reading state of ONOS
+ """
+ main.HA.readingState( main )
+
+ def CASE60( self, main ):
+ """
+ Initialize the upgrade.
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Initialize upgrade" )
+ main.HA.upgradeInit( main )
+
+ def CASE61( self, main ):
+ """
+ Upgrade a minority of nodes PHASE 1
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Upgrade minority of ONOS nodes" )
+
+ main.step( "Checking ONOS Logs for errors" )
+ for ctrl in main.Cluster.active():
+ main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
+ main.log.warn( ctrl.checkLogs( ctrl.ipAddress ) )
+
+ main.kill = []
+ n = len( main.Cluster.runningNodes ) # Number of nodes
+ p = n / 2 # Number of nodes in the minority
+ for i in range( p ):
+ main.kill.append( main.Cluster.runningNodes[ i ] ) # ONOS node to kill, listed by index in main.nodes
+ main.HA.upgradeNodes( main )
+
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ if not nodeResults:
+ for ctrl in main.Cluster.active():
+ main.log.debug( "{} components not ACTIVE: \n{}".format(
+ ctrl.name,
+ ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+ main.log.error( "Failed to start ONOS, stopping test" )
+ main.cleanAndExit()
+
+ def CASE62( self, main ):
+ """
+ Transfer to new version. PHASE 2
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Start the upgrade" )
+
+ main.step( "Send the command to switch to new version" )
+ ctrl = main.Cluster.next().CLI
+ upgraded = ctrl.issuUpgrade()
+ utilities.assert_equals( expect=main.TRUE, actual=upgraded,
+ onpass="Cluster has moved to the upgraded nodes",
+ onfail="Error transitioning to the upgraded nodes" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+ # TODO: check things here?
+
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ def CASE63( self, main ):
+ """
+ Rollback the upgrade
+ """
+ main.case( "Rollback the upgrade" )
+ main.step( "Rollbak the upgrade" )
+ # send rollback command
+ ctrl = main.Cluster.next().CLI
+ rollback = ctrl.issuRollback()
+ utilities.assert_equals( expect=main.TRUE, actual=rollback,
+ onpass="Upgrade has been rolled back",
+ onfail="Error rolling back the upgrade" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+
+ # restart and reinstall old version on upgrade nodes
+ for ctrl in main.kill:
+ ctrl.onosStop( ctrl.ipAddress )
+ ctrl.onosUninstall( ctrl.ipAddress )
+ ctrl.onosInstall( options="-f", node=ctrl.ipAddress )
+ ctrl.onosSecureSSH( node=ctrl.ipAddress )
+ ctrl.startOnosCli( ctrl.ipAddress, waitForStart=True )
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ if not nodeResults:
+ for ctrl in main.Cluster.active():
+ main.log.debug( "{} components not ACTIVE: \n{}".format(
+ ctrl.name,
+ ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+ main.log.error( "Failed to start ONOS, stopping test" )
+ main.cleanAndExit()
+
+ def CASE64( self, main ):
+ """
+ Reset the upgrade state.
+ """
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ main.case( "Reset the upgrade state" )
+
+ main.step( "Send the command to reset the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ committed = ctrl.issuCommit()
+ utilities.assert_equals( expect=main.TRUE, actual=committed,
+ onpass="Upgrade has been committed",
+ onfail="Error committing the upgrade" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+ # TODO: check things here?
+
+ def CASE7( self, main ):
+ """
+ Check state after ONOS failure
+ """
+ try:
+ main.kill
+ except AttributeError:
+ main.kill = []
+
+ main.HA.checkStateAfterEvent( main, afterWhich=0 )
+ main.step( "Leadership Election is still functional" )
+ # Test of LeadershipElection
+ leaderList = []
+
+ restarted = []
+ for ctrl in main.kill:
+ restarted.append( ctrl.ipAddress )
+ leaderResult = main.TRUE
+
+ for ctrl in main.Cluster.active():
+ leaderN = ctrl.electionTestLeader()
+ leaderList.append( leaderN )
+ if leaderN == main.FALSE:
+ # error in response
+ main.log.error( "Something is wrong with " +
+ "electionTestLeader function, check the" +
+ " error logs" )
+ leaderResult = main.FALSE
+ elif leaderN is None:
+ main.log.error( ctrl.name +
+ " shows no leader for the election-app was" +
+ " elected after the old one died" )
+ leaderResult = main.FALSE
+ elif leaderN in restarted:
+ main.log.error( ctrl.name + " shows " + str( leaderN ) +
+ " as leader for the election-app, but it " +
+ "was restarted" )
+ leaderResult = main.FALSE
+ if len( set( leaderList ) ) != 1:
+ leaderResult = main.FALSE
+ main.log.error(
+ "Inconsistent view of leader for the election test app" )
+ # TODO: print the list
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=leaderResult,
+ onpass="Leadership election passed",
+ onfail="Something went wrong with Leadership election" )
+
+ def CASE8( self, main ):
+ """
+ Compare topo
+ """
+ main.HA.compareTopo( main )
+
+ def CASE9( self, main ):
+ """
+ Link s3-s28 down
+ """
+ main.HA.linkDown( main )
+
+ def CASE10( self, main ):
+ """
+ Link s3-s28 up
+ """
+ main.HA.linkUp( main )
+
+ def CASE11( self, main ):
+ """
+ Switch Down
+ """
+ # NOTE: You should probably run a topology check after this
+ main.HA.switchDown( main )
+
+ def CASE12( self, main ):
+ """
+ Switch Up
+ """
+ # NOTE: You should probably run a topology check after this
+ main.HA.switchUp( main )
+
+ def CASE13( self, main ):
+ """
+ Clean up
+ """
+ main.HAlabels.append( "Restart" )
+ main.HAdata.append( str( main.restartTime ) )
+ main.HA.cleanUp( main )
+
+ def CASE14( self, main ):
+ """
+ start election app on all onos nodes
+ """
+ main.HA.startElectionApp( main )
+
+ def CASE15( self, main ):
+ """
+ Check that Leadership Election is still functional
+ 15.1 Run election on each node
+ 15.2 Check that each node has the same leaders and candidates
+ 15.3 Find current leader and withdraw
+ 15.4 Check that a new node was elected leader
+ 15.5 Check that that new leader was the candidate of old leader
+ 15.6 Run for election on old leader
+ 15.7 Check that oldLeader is a candidate, and leader if only 1 node
+ 15.8 Make sure that the old leader was added to the candidate list
+
+ old and new variable prefixes refer to data from before vs after
+ withdrawl and later before withdrawl vs after re-election
+ """
+ main.HA.isElectionFunctional( main )
+
+ def CASE16( self, main ):
+ """
+ Install Distributed Primitives app
+ """
+ main.HA.installDistributedPrimitiveApp( main )
+
+ def CASE17( self, main ):
+ """
+ Check for basic functionality with distributed primitives
+ """
+ main.HA.checkDistPrimitivesFunc( main )
diff --git a/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.topo b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.topo
new file mode 100644
index 0000000..4bf4bd4
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.topo
@@ -0,0 +1,53 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></onos_home> # defines where onos home is
+ <nodes> 7 </nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ #Specify the Option for mininet
+ <arg1> --custom ~/mininet/custom/obelisk.py </arg1>
+ <arg2> --topo obelisk </arg2>
+ <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+ <controller> none </controller>
+ <home>~/mininet/custom/</home>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet1>
+
+ <Mininet2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>RemoteMininetDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet2>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HA/HAupgradeRollback/README b/TestON/tests/HA/HAupgradeRollback/README
new file mode 100644
index 0000000..396c222
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/README
@@ -0,0 +1,29 @@
+This test is designed to verify that an ONOS cluster behaves correctly when some
+ONOS nodes are upgrade. Then test will initilize the upgrade then stop, upgrade,
+and restart a minority of the nodes in the cluster. Then we will start the first
+phase of the upgrade process to transfer to the new version. Then we will roll-back
+the upgrade, Restarted the upgraded nodes with the older version. After that the
+test will verify everything works and reset the upgrade.
+
+As written, the test only supports an ONOS cluster of 3, 5, or 7 nodes.
+This is because the test doesn't apply to a single node cluster and ONOS clusters
+should be deployed in odd numbers.
+
+The gerneral structure for the test:
+- Startup
+- Assign switches
+- Verify ONOS state and functionality
+ - Device mastership
+ - Intents
+ - Leadership election
+ - Distributed Primitives
+- Initialize an upgrade
+- Upgrade some ONOS nodes
+- Verify ONOS state and functionality
+- Transfer to new version
+- Upgrade the rest of the nodes
+- Verify ONOS state and functionality
+- Commit the upgrade
+- Dataplane failures
+ - link down and up
+ - switch down and up
diff --git a/TestON/tests/HA/HAupgradeRollback/__init__.py b/TestON/tests/HA/HAupgradeRollback/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/__init__.py
diff --git a/TestON/tests/HA/HAupgradeRollback/dependencies/__init__.py b/TestON/tests/HA/HAupgradeRollback/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/HA/HAupgradeRollback/dependencies/__init__.py
diff --git a/TestON/tests/HA/dependencies/HA.py b/TestON/tests/HA/dependencies/HA.py
index c781a52..c61cd4f 100644
--- a/TestON/tests/HA/dependencies/HA.py
+++ b/TestON/tests/HA/dependencies/HA.py
@@ -20,6 +20,8 @@
"""
import json
import time
+import pexpect
+import re
class HA():
@@ -69,7 +71,6 @@
onfail="Error starting Mininet" )
def scalingMetadata( self ):
- import re
main.step( "Generate initial metadata file" )
main.scaling = main.params[ 'scaling' ].split( "," )
main.log.debug( main.scaling )
@@ -298,7 +299,7 @@
main.step( "Checking ONOS nodes" )
nodeResults = utilities.retry( main.Cluster.nodesCheck,
False,
- attempts=5 )
+ attempts=9 )
utilities.assert_equals( expect=True, actual=nodeResults,
onpass="Nodes check successful",
@@ -450,12 +451,21 @@
Check App IDs on all nodes
"""
# FIXME: Rename this to appIDCheck? or add a check for isntalled apps
- appResults = main.Cluster.command( "appToIDCheck" )
- appCheck = all( i == main.TRUE for i in appResults )
+ for i in range( 15 ):
+ # TODO modify retry or add a new version that accepts looking for
+ # a value in a return list instead of needing to match the entire
+ # return value to retry
+ appResults = main.Cluster.command( "appToIDCheck" )
+ appCheck = all( i == main.TRUE for i in appResults )
+ if appCheck:
+ break
+ else:
+ time.sleep( 5 )
+
if not appCheck:
ctrl = main.Cluster.active( 0 )
- main.log.debug( "%s apps: %s" % ( ctrl.name, ctrl.apps() ) )
- main.log.debug( "%s appIDs: %s" % ( ctrl.name, ctrl.appIDs() ) )
+ main.log.debug( "%s apps: %s" % ( ctrl.name, ctrl.pprint( ctrl.apps() ) ) )
+ main.log.debug( "%s appIDs: %s" % ( ctrl.name, ctrl.pprint( ctrl.appIDs() ) ) )
return appCheck
def workQueueStatsCheck( self, workQueueName, completed, inProgress, pending ):
@@ -759,7 +769,6 @@
pendingMap = main.Cluster.next().pendingMap()
if not intentAddResult or "key" in pendingMap:
- import time
installedCheck = True
main.log.info( "Sleeping 60 seconds to see if intents are found" )
time.sleep( 60 )
@@ -812,7 +821,7 @@
main.step( "Check Intent state" )
installedCheck = False
loopCount = 0
- while not installedCheck and loopCount < 40:
+ while not installedCheck and loopCount < 90:
installedCheck = True
# Print the intent states
intents = onosCli.CLI.intents()
@@ -1007,7 +1016,6 @@
Reading state of ONOS
"""
import json
- import time
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
try:
@@ -2477,8 +2485,6 @@
"""
Clean up
"""
- import os
- import time
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
@@ -2532,17 +2538,17 @@
else:
main.log.debug( "skipping saving log files" )
+ main.step( "Checking ONOS Logs for errors" )
+ for ctrl in main.Cluster.runningNodes:
+ main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
+ main.log.warn( main.ONOSbench.checkLogs( ctrl.ipAddress ) )
+
main.step( "Stopping Mininet" )
mnResult = main.Mininet1.stopNet()
utilities.assert_equals( expect=main.TRUE, actual=mnResult,
onpass="Mininet stopped",
onfail="MN cleanup NOT successful" )
- main.step( "Checking ONOS Logs for errors" )
- for ctrl in main.Cluster.runningNodes:
- main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
- main.log.warn( main.ONOSbench.checkLogs( ctrl.ipAddress ) )
-
try:
timerLog = open( main.logdir + "/Timers.csv", 'w' )
main.log.debug( ", ".join( main.HAlabels ) + "\n" + ", ".join( main.HAdata ) )
@@ -2663,9 +2669,9 @@
"controller",
onfail="Switches were not successfully reassigned" )
- def bringUpStoppedNode( self, main ):
+ def bringUpStoppedNodes( self, main ):
"""
- The bring up stopped nodes
+ The bring up stopped nodes.
"""
import time
assert main, "main not defined"
@@ -2696,7 +2702,7 @@
onpass="ONOS restarted successfully",
onfail="ONOS restart NOT successful" )
- main.step( "Restarting ONOS nodes" )
+ main.step( "Restarting ONOS CLI" )
cliResults = main.TRUE
for ctrl in main.kill:
cliResults = cliResults and\
@@ -2706,8 +2712,7 @@
onpass="ONOS node(s) restarted",
onfail="ONOS node(s) did not restart" )
- # Grab the time of restart so we chan check how long the gossip
- # protocol has had time to work
+ # Grab the time of restart so we can have some idea of average time
main.restartTime = time.time() - restartTime
main.log.debug( "Restart time: " + str( main.restartTime ) )
# TODO: MAke this configurable. Also, we are breaking the above timer
@@ -2738,7 +2743,96 @@
ctrl.electionTestRun()
utilities.assert_equals( expect=main.TRUE, actual=runResults,
onpass="ONOS nodes reran for election topic",
- onfail="Errror rerunning for election" )
+ onfail="Error rerunning for election" )
+
+ def upgradeNodes( self, main ):
+ """
+ Reinstall some nodes with an upgraded version.
+
+ This will reinstall nodes in main.kill with an upgraded version.
+ """
+ import time
+ assert main, "main not defined"
+ assert utilities.assert_equals, "utilities.assert_equals not defined"
+ assert main.kill, "main.kill not defined"
+ nodeNames = [ node.name for node in main.kill ]
+ main.step( "Upgrading" + str( nodeNames ) + " ONOS nodes" )
+
+ stopResults = main.TRUE
+ uninstallResults = main.TRUE
+ startResults = main.TRUE
+ sshResults = main.TRUE
+ isup = main.TRUE
+ restartTime = time.time()
+ for ctrl in main.kill:
+ stopResults = stopResults and\
+ ctrl.onosStop( ctrl.ipAddress )
+ uninstallResults = uninstallResults and\
+ ctrl.onosUninstall( ctrl.ipAddress )
+ # Install the new version of onos
+ startResults = startResults and\
+ ctrl.onosInstall( options="-fv", node=ctrl.ipAddress )
+ sshResults = sshResults and\
+ ctrl.onosSecureSSH( node=ctrl.ipAddress )
+ isup = isup and ctrl.isup( ctrl.ipAddress )
+ utilities.assert_equals( expect=main.TRUE, actual=stopResults,
+ onpass="ONOS nodes stopped successfully",
+ onfail="ONOS nodes NOT successfully stopped" )
+ utilities.assert_equals( expect=main.TRUE, actual=uninstallResults,
+ onpass="ONOS nodes uninstalled successfully",
+ onfail="ONOS nodes NOT successfully uninstalled" )
+ utilities.assert_equals( expect=main.TRUE, actual=startResults,
+ onpass="ONOS nodes started successfully",
+ onfail="ONOS nodes NOT successfully started" )
+ utilities.assert_equals( expect=main.TRUE, actual=sshResults,
+ onpass="Successfully secured onos ssh",
+ onfail="Failed to secure onos ssh" )
+ utilities.assert_equals( expect=main.TRUE, actual=isup,
+ onpass="ONOS nodes fully started",
+ onfail="ONOS nodes NOT fully started" )
+
+ main.step( "Restarting ONOS CLI" )
+ cliResults = main.TRUE
+ for ctrl in main.kill:
+ cliResults = cliResults and\
+ ctrl.startOnosCli( ctrl.ipAddress )
+ ctrl.active = True
+ utilities.assert_equals( expect=main.TRUE, actual=cliResults,
+ onpass="ONOS node(s) restarted",
+ onfail="ONOS node(s) did not restart" )
+
+ # Grab the time of restart so we can have some idea of average time
+ main.restartTime = time.time() - restartTime
+ main.log.debug( "Restart time: " + str( main.restartTime ) )
+ # TODO: Make this configurable.
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
+
+ if not nodeResults:
+ for ctrl in main.Cluster.active():
+ main.log.debug( "{} components not ACTIVE: \n{}".format(
+ ctrl.name,
+ ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+ main.log.error( "Failed to start ONOS, stopping test" )
+ main.cleanAndExit()
+
+ self.commonChecks()
+
+ main.step( "Rerun for election on the node(s) that were killed" )
+ runResults = main.TRUE
+ for ctrl in main.kill:
+ runResults = runResults and\
+ ctrl.electionTestRun()
+ utilities.assert_equals( expect=main.TRUE, actual=runResults,
+ onpass="ONOS nodes reran for election topic",
+ onfail="Error rerunning for election" )
def tempCell( self, cellName, ipList ):
main.step( "Create cell file" )
@@ -3048,8 +3142,8 @@
elapsed = time.time() - startTime
cliTime = time.time() - cliStart
- print "Elapsed time: " + str( elapsed )
- print "CLI time: " + str( cliTime )
+ main.log.debug( "Elapsed time: " + str( elapsed ) )
+ main.log.debug( "CLI time: " + str( cliTime ) )
if all( e is None for e in devices ) and\
all( e is None for e in hosts ) and\
@@ -3493,15 +3587,18 @@
onfail="Inconsistent leaderboards" )
if sameResult:
+ # Check that the leader is one of the active nodes
+ ips = sorted( main.Cluster.getIps( activeOnly=True ) )
leader = leaders[ 0 ][ 0 ]
- if onosCli.ipAddress in leader:
- correctLeader = True
+ if leader in ips:
+ legitimate = True
else:
- correctLeader = False
- main.step( "First node was elected leader" )
+ legitimate = False
+ main.log.debug( leaders )
+ main.step( "Active node was elected leader?" )
utilities.assert_equals(
expect=True,
- actual=correctLeader,
+ actual=legitimate,
onpass="Correct leader was elected",
onfail="Incorrect leader" )
main.Cluster.testLeader = leader
@@ -3620,18 +3717,6 @@
else:
main.log.info( "Expected no leader, got: " + str( newLeader ) )
correctCandidateResult = main.FALSE
- elif len( oldLeaders[ 0 ] ) >= 3:
- if newLeader == oldLeaders[ 0 ][ 2 ]:
- # correct leader was elected
- correctCandidateResult = main.TRUE
- else:
- correctCandidateResult = main.FALSE
- main.log.error( "Candidate {} was elected. {} should have had priority.".format(
- newLeader, oldLeaders[ 0 ][ 2 ] ) )
- else:
- main.log.warn( "Could not determine who should be the correct leader" )
- main.log.debug( oldLeaders[ 0 ] )
- correctCandidateResult = main.FALSE
utilities.assert_equals(
expect=main.TRUE,
actual=correctCandidateResult,
@@ -3659,24 +3744,10 @@
time.sleep( 5 ) # Paremterize
positionResult, reRunLeaders = self.consistentLeaderboards( activeCLIs )
- # Check that the re-elected node is last on the candidate List
- if not reRunLeaders[ 0 ]:
- positionResult = main.FALSE
- elif oldLeader != reRunLeaders[ 0 ][ -1 ]:
- main.log.error( "Old Leader ({}) not in the proper position: {} ".format( str( oldLeader ),
- str( reRunLeaders[ 0 ] ) ) )
- positionResult = main.FALSE
- utilities.assert_equals(
- expect=True,
- actual=positionResult,
- onpass="Old leader successfully re-ran for election",
- onfail="Something went wrong with Leadership election after " +
- "the old leader re-ran for election" )
-
def installDistributedPrimitiveApp( self, main ):
- """
+ '''
Install Distributed Primitives app
- """
+ '''
import time
assert main, "main not defined"
assert utilities.assert_equals, "utilities.assert_equals not defined"
@@ -3698,3 +3769,29 @@
onfail="Primitives app not activated" )
# TODO check on all nodes instead of sleeping
time.sleep( 5 ) # To allow all nodes to activate
+
+ def upgradeInit( self, main ):
+ '''
+ Initiates an update
+ '''
+ main.step( "Send the command to initialize the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ initialized = ctrl.issuInit()
+ utilities.assert_equals( expect=main.TRUE, actual=initialized,
+ onpass="ISSU initialized",
+ onfail="Error initializing the upgrade" )
+
+ main.step( "Check the status of the upgrade" )
+ ctrl = main.Cluster.next().CLI
+ status = ctrl.issu()
+ main.log.debug( status )
+ # TODO: check things here?
+
+ main.step( "Checking ONOS nodes" )
+ nodeResults = utilities.retry( main.Cluster.nodesCheck,
+ False,
+ sleep=15,
+ attempts=5 )
+ utilities.assert_equals( expect=True, actual=nodeResults,
+ onpass="Nodes check successful",
+ onfail="Nodes check NOT successful" )
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index 1ad81ad..d536106 100644
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -86,7 +86,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
+ main.testSetUp.ONOSSetUp( main.Cluster,
skipPack=main.skipPackaging )
def CASE10( self, main ):
diff --git a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.params b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.params
index 4e66dea..f9558d5 100755
--- a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.params
+++ b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.params
@@ -1,6 +1,6 @@
<PARAMS>
- <testcases>0,[1,1000,10,110,900,1000]*12,1001</testcases>
+ <testcases>0,[1,1000,10,110,120,130,140,299,900,1000]*12,1001</testcases>
<DOCKER>
<repo>onosproject/onos</repo>
@@ -15,7 +15,10 @@
<CASE110>
<clustercmdpath>../tests/PLAT/PLATdockertest/dependencies</clustercmdpath>
- <apps>org.onosproject.proxyarp,org.onosproject.fwd</apps>
+ <apps>org.onosproject.proxyarp,org.onosproject.fwd,org.onosproject.openflow</apps>
+ <mnCmd>mn --topo tree,2 --controller remote,ip=</mnCmd>
+ <swDPID>of:0000000000000002</swDPID>
+ <debug>on</debug>
</CASE110>
<ENV>
diff --git a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
index dba226c..d871fae 100644
--- a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
+++ b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
@@ -171,12 +171,13 @@
def CASE110( self, main ):
"""
+ Docker init testing
+
Steps:
1 ) check default startup standalone onos applications status;
2 ) form onos cluster with all nodes;
3 ) check onos applications status;
4 ) activate apps per params and check app status;
- 5 ) deactivate apps and check app status
"""
import time
@@ -185,15 +186,17 @@
main.case( "Form onos cluster and check status of onos apps for onos image {}".format( DOCKERTAG ) )
startupSleep = int( main.params[ "SLEEP" ][ "startup" ] )
+ main.swDPID = main.params[ "CASE110" ][ "swDPID" ]
+ main.debug = main.params[ "CASE110" ][ "debug" ]
appToAct = main.params[ "CASE110" ][ "apps" ]
- stepResult = main.FALSE
+ main.initResult = main.FALSE
main.log.info( "Wait for startup, sleep (sec): " + str( startupSleep ) )
time.sleep( startupSleep )
main.step( "Check initial app states from onos1 for onos image {}".format( DOCKERTAG ) )
- stepResult = main.TRUE
+ main.initResult = main.TRUE
response = main.ONOSbenchRest.apps( ip=IPlist[ 0 ], port=8181 )
main.log.debug( "Rest call response is: " + response )
if response is not main.FALSE:
@@ -201,20 +204,20 @@
if item[ "state" ] not in [ "ACTIVE", "INSTALLED" ]:
main.log.info( "Some bundles are not in correct state. " )
main.log.info( "App states are: " + response )
- stepResult = main.FALSE
+ main.initResult = main.FALSE
break
if ( item[ "description" ] == "Builtin device drivers" ) and ( item[ "state" ] != "ACTIVE" ):
main.log.info( "Driver app is not in 'ACTIVE' state, but in: " + item[ "state" ] )
- stepResult = main.FALSE
+ main.initResult = main.FALSE
break
- utilities.assert_equals( expect=main.TRUE, actual=stepResult,
+ utilities.assert_equals( expect=main.TRUE, actual=main.initResult,
onpass="ONOS successfully started",
onfail="Failed to start ONOS correctly" )
- if stepResult is main.FALSE:
+ if main.initResult is main.FALSE:
main.skipCase()
main.step( "Form onos cluster using 'dependencies/onos-form-cluster' util" )
- stepResult = main.FALSE
+ main.initResult = main.FALSE
clcmdpath = main.params[ "CASE110" ][ "clustercmdpath" ]
main.log.info( "onos-form-cluster cmd path is: " + clcmdpath )
dkruser = main.params[ "DOCKER" ][ "user" ]
@@ -233,52 +236,196 @@
main.log.debug( " IPlist is:" + ",".join( IPlist ) )
main.log.debug( " cluster IP is" + ",".join( clusterIP ) )
if set( IPlist ) == set( clusterIP ):
- stepResult = main.TRUE
+ main.initResult = main.TRUE
- utilities.assert_equals( expect=main.TRUE, actual=stepResult,
+ utilities.assert_equals( expect=main.TRUE, actual=main.initResult,
onpass="ONOS successfully started",
onfail="Failed to start ONOS correctly" )
- if stepResult is main.FALSE:
+ if main.initResult is main.FALSE:
main.skipCase()
main.step( "Check cluster app status" )
- stepResult = main.TRUE
+ main.initResult = main.TRUE
response = main.ONOSbenchRest.apps( ip=IPlist[ 0 ], port=8181 )
if response is not main.FALSE:
for item in json.loads( response ):
if item[ "state" ] not in [ "ACTIVE", "INSTALLED" ]:
main.log.info( "Some bundles are not in correct state. " )
main.log.info( "App states are: " + response )
- stepResult = main.FALSE
+ main.initResult = main.FALSE
break
if ( item[ "description" ] == "Builtin device drivers" ) and ( item[ "state" ] != "ACTIVE" ):
main.log.info( "Driver app is not in 'ACTIVE' state, but in: " + item[ "state" ] )
- stepResult = main.FALSE
+ main.initResult = main.FALSE
break
- utilities.assert_equals( expect=main.TRUE, actual=stepResult,
+ utilities.assert_equals( expect=main.TRUE, actual=main.initResult,
onpass="ONOS successfully started",
onfail="Failed to start ONOS correctly" )
- if stepResult is main.FALSE:
+ if main.initResult is main.FALSE:
main.skipCase()
main.step( " Activate an APP from REST and check APP status" )
appResults = list()
- stepResult = main.TRUE
+ main.initResult = main.TRUE
applist = main.params[ "CASE110" ][ "apps" ].split( "," )
main.log.info( "List of apps to activate: " + str( applist ) )
for app in applist:
appRslt = main.ONOSbenchRest.activateApp( appName=app, ip=IPlist[ 0 ], port=8181, check=True )
time.sleep( 5 )
appResults.append( appRslt )
- stepResult = stepResult and appRslt
+ main.initResult = main.initResult and appRslt
main.log.debug( "Apps activation result for " + ",".join( applist ) + ": " + str( appResults ) )
- utilities.assert_equals( expect=main.TRUE, actual=stepResult,
+ utilities.assert_equals( expect=main.TRUE, actual=main.initResult,
onpass="Successfully activated apps",
onfail="Failed to activated apps correctly" )
- if stepResult is main.FALSE:
+
+ def CASE120( self, main ):
+ """
+ Docker Mininet testing
+ """
+ import time
+ import json
+ from operator import itemgetter
+
+ if main.initResult is main.FALSE:
+ main.mininetResult = main.FALSE
main.skipCase()
- main.step( " Deactivate an APP from REST and check APP status" )
+ main.step( "Loading Mininet Topology." )
+
+ mnCmd = main.params[ "CASE110" ][ "mnCmd" ]
+ main.mininetResult = main.Mininet1.startNet( mnCmd=mnCmd + IPlist[ 0 ] )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=main.mininetResult,
+ onpass="Successfully loaded topology.",
+ onfail="Failed to load topology" )
+
+ if main.mininetResult is main.FALSE:
+ main.skipCase()
+
+ main.mininetResult = utilities.retry( f=main.Mininet1.pingall,
+ retValue=main.FALSE,
+ attempts=3,
+ sleep=5 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=main.mininetResult,
+ onpass="Successfully loaded topology.",
+ onfail="Failed to load topology" )
+
+ def CASE130( self, main ):
+ """
+ Docker Intents testing
+ """
+ import time
+ import json
+ from operator import itemgetter
+
+ if main.initResult is main.FALSE or main.mininetResult is main.FALSE:
+ main.intentResult = False
+ main.skipCase()
+
+ main.hosts = sorted( json.loads( main.ONOSbenchRest.hosts( ip=IPlist[ 0 ] ) ), key=itemgetter( "ipAddresses" ) )
+ main.ONOSbenchRest.addHostIntent( main.hosts[ 0 ][ "id" ], main.hosts[ -1 ][ "id" ], ip=IPlist[ 0 ] )
+ main.ONOSbenchRest.addHostIntent( main.hosts[ 1 ][ "id" ], main.hosts[ -2 ][ "id" ], ip=IPlist[ 0 ] )
+
+ main.log.info( "Sleeping for 5 seconds to avoid potential race condition..." )
+ time.sleep( 5 )
+
+ main.step( "Get the intents from each controller" )
+ main.ONOSIntents = main.ONOSbenchRest.intents( IPlist[ 0 ] )
+ main.intentResult = True
+ for i in range( 0, len( IPlist ) ):
+ node = str( IPlist[ i ] )
+ if not main.ONOSIntents[ i ] or "Error" in main.ONOSIntents[ i ]:
+ main.log.error( "Error in getting " + node + " intents" )
+ main.log.warn( node + " intents response: " +
+ repr( main.ONOSIntents[ i ] ) )
+ main.intentResult = False
+
+ utilities.assert_equals( expect=True,
+ actual=main.intentResult,
+ onpass="No error in reading intents output",
+ onfail="Error in reading intents from ONOS" )
+
+ if not main.intentResult:
+ main.skipCase()
+
+ main.step( "Checking intent state" )
+
+ main.intentResult = json.loads( main.ONOSIntents )[ 0 ][ "state" ] == "INSTALLED"
+
+ utilities.assert_equals( expect=True,
+ actual=main.intentResult,
+ onpass="Intent check successful.",
+ onfail="Intent check failed." )
+
+ def CASE140( self, main ):
+ """
+ Docker Flows testing
+ """
+ import time
+ import json
+
+ if main.initResult is main.FALSE or not main.intentResult:
+ main.skipCase()
+
+ main.step( "Adding flows." )
+
+ ingress = 1
+ egress = 2
+
+ main.log.info( "Add flow with MAC selectors." )
+ main.flowResult = main.ONOSbenchRest.addFlow( deviceId=main.swDPID,
+ egressPort=egress,
+ ingressPort=ingress,
+ ethSrc=main.hosts[ 0 ][ 'mac' ],
+ ethDst=main.hosts[ 1 ][ 'mac' ],
+ debug=main.debug,
+ ip=IPlist[ 0 ] )
+
+ main.log.info( "Sleeping for 10 seconds..." )
+ time.sleep( 10 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=main.flowResult,
+ onpass="Successfully added flows",
+ onfail="Failed to add flows" )
+
+ def CASE299( self, main ):
+ """
+ Cleanup Docker testing
+ """
+ import time
+ import json
+
+ if main.initResult is main.FALSE:
+ main.skipCase()
+
+ if main.flowResult is main.TRUE:
+ main.step( "Remove flow." )
+
+ prevFlow = json.loads( main.ONOSbenchRest.getFlows( main.swDPID, ip=IPlist[ 0 ] ) )[ -1 ]
+ stepResult = main.ONOSbenchRest.removeFlow( main.swDPID, prevFlow[ 'id' ], ip=IPlist[ 0 ] )
+ utilities.assert_equals( expect=main.TRUE, actual=stepResult,
+ onpass="Successfully removed flow.",
+ onfail="Failed to remove flow." )
+
+ if main.intentResult:
+ main.step( "Remove intents." )
+ results = []
+ for i in range( 0, len( json.loads( main.ONOSIntents ) ) ):
+ intentID = json.loads( main.ONOSbenchRest.intents( IPlist[ 0 ] ) )[ 0 ][ 'id' ]
+ results.append( main.ONOSbenchRest.removeIntent( intentID, ip=IPlist[ 0 ] ) == main.TRUE )
+
+ utilities.assert_equals( expect=True, actual=all( results ),
+ onpass="Successfully removed intents.",
+ onfail="Failed to remove intents." )
+
+ if main.mininetResult is main.TRUE:
+ main.Mininet1.stopNet()
+
+ main.step( "Deactivate an APP from REST and check APP status" )
appResults = list()
stepResult = main.TRUE
applist = main.params[ "CASE110" ][ "apps" ].split( "," )
@@ -290,10 +437,8 @@
stepResult = stepResult and appRslt
main.log.debug( "Apps deactivation result for " + ",".join( applist ) + ": " + str( appResults ) )
utilities.assert_equals( expect=main.TRUE, actual=stepResult,
- onpass="Successfully deactivated apps",
- onfail="Failed to deactivated apps correctly" )
- if stepResult is main.FALSE:
- main.skipCase()
+ onpass="Successfully deactivated apps",
+ onfail="Failed to deactivated apps correctly" )
def CASE900( self, main ):
"""
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
index 3a17969..09c7fc2 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
@@ -29,7 +29,10 @@
<pull>False</pull>
<branch>master</branch>
</GIT>
-
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
<CASE0>
</CASE0>
@@ -46,7 +49,7 @@
<CASE10>
<numNodes>1</numNodes>
<Apps>
- org.onosproject.openflow,org.onosproject.fwd
+ org.onosproject.openflow
</Apps>
<ONOS_Configuration>
<org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 37020b3..4fb94c9 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -34,33 +34,17 @@
test env. We want Jenkins jobs to pull&build for flexibility to handle
different versions of ONOS.
"""
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
+ from tests.dependencies.ONOSSetup import ONOSSetup
+ main.testSetUp = ONOSSetup()
main.testSetUp.gitPulling()
+ from tests.dependencies.Network import Network
+ main.Network = Network()
def CASE1( self, main ):
"""
Set up global test variables;
Uninstall all running cells in test env defined in .topo file
-
"""
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
-
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
@@ -95,27 +79,14 @@
3 ) configure onos via ONOSCliDriver;
"""
import time
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
main.step( "Start ONOS cluster with basic (drivers) app." )
- stepResult = main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(),
- opSleep=200,
- onosUser=main.ONOScell.karafUser )
+ stepResult = main.testSetUp.ONOSSetUp( main.Cluster )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully started basic ONOS cluster ",
onfail="Failed to start basic ONOS Cluster " )
- main.testSetUp.startOnosClis( main.Cluster )
-
main.step( "Activate onos apps." )
main.apps = main.params[ 'CASE10' ].get( 'Apps' )
if main.apps:
@@ -161,7 +132,7 @@
main.case( "Start Mininet topology" )
main.step( "Starting Mininet Topology" )
- topoResult = main.Mininet1.startNet( mnCmd=topology )
+ topoResult = main.Network.startNet( mnCmd=topology )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -175,7 +146,7 @@
assignResult = main.TRUE
for i in range( 1, 8 ):
assignResult = assignResult & \
- main.Mininet1.assignSwController( sw="s" + str( i ),
+ main.Network.assignSwController( sw="s" + str( i ),
ip=main.Cluster.getIps(),
port='6653' )
time.sleep( main.mnCfgSleep )
@@ -217,10 +188,10 @@
main.step( "Run pingall to check connectivity. " )
pingResult = main.FALSE
passMsg = "Reactive Pingall test passed"
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Network.pingall()
if not pingResult:
main.log.warn( "First pingall failed. Trying again..." )
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Network.pingall()
passMsg += "on the second try"
utilities.assert_equals( expect=main.TRUE,
actual=pingResult,
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
index fe36d6e..0eead29 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
@@ -15,7 +15,10 @@
<pull>False</pull>
<branch>master</branch>
</GIT>
-
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
<CASE0>
<gitPull>False</gitPull> # False or True
<gitBranch>master</gitBranch>
@@ -32,7 +35,7 @@
<CASE10>
<Apps>
- org.onosproject.openflow,org.onosproject.fwd
+ org.onosproject.openflow
</Apps>
<ONOS_Configuration>
<org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index cb5019c..21d86d4 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -34,17 +34,11 @@
test env. We want Jenkins jobs to pull&build for flexibility to handle
different versions of ONOS.
"""
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
-
+ from tests.dependencies.ONOSSetup import ONOSSetup
+ main.testSetUp = ONOSSetup()
main.testSetUp.gitPulling()
+ from tests.dependencies.Network import Network
+ main.Network = Network()
def CASE1( self, main ):
"""
@@ -52,16 +46,6 @@
Uninstall all running cells in test env defined in .topo file
"""
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
-
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
@@ -95,29 +79,18 @@
2 ) activate apps via ONOSCliDriver;
3 ) configure onos via ONOSCliDriver;
"""
- try:
- from tests.dependencies.ONOSSetup import ONOSSetup
- except ImportError:
- main.log.error( "ONOSSetup not found. exiting the test" )
- main.cleanAndExit()
- try:
- main.testSetUp
- except ( NameError, AttributeError ):
- main.testSetUp = ONOSSetup()
-
import time
main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
main.step( "Start ONOS cluster with basic (drivers) app." )
- stepResult = main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(), opSleep=200,
- onosUser=main.ONOScell.karafUser )
+ stepResult = main.testSetUp.ONOSSetUp( main.Cluster )
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully started basic ONOS cluster ",
onfail="Failed to start basic ONOS Cluster " )
- main.testSetUp.startOnosClis()
+ main.testSetUp.startOnosClis( main.Cluster )
main.step( "Activate onos apps." )
main.apps = main.params[ 'CASE10' ].get( 'Apps' )
@@ -164,7 +137,7 @@
main.case( "Start Mininet topology" )
main.step( "Starting Mininet Topology" )
- topoResult = main.Mininet1.startNet( mnCmd=topology )
+ topoResult = main.Network.startNet( mnCmd=topology )
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
@@ -177,7 +150,7 @@
main.step( "Assign switches to controllers." )
assignResult = main.TRUE
for i in range( 1, 8 ):
- assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
+ assignResult = assignResult & main.Network.assignSwController( sw="s" + str( i ),
ip=main.Cluster.getIps(),
port='6653' )
time.sleep( main.mnCfgSleep )
@@ -219,10 +192,10 @@
main.step( "Run pingall to check connectivity. " )
pingResult = main.FALSE
passMsg = "Reactive Pingall test passed"
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Network.pingall()
if not pingResult:
main.log.warn( "First pingall failed. Trying again..." )
- pingResult = main.Mininet1.pingall()
+ pingResult = main.Network.pingall()
passMsg += "on the second try"
utilities.assert_equals( expect=main.TRUE,
actual=pingResult,
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
index c139d48..4a09129 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
@@ -56,7 +56,7 @@
main.commit = ( main.commit.split( " " ) )[ 1 ]
# -- END OF INIT SECTION --#
- main.testSetUp.ONOSSetUp( MN1Ip, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName )
for i in range( 5 ):
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index c86ecac..45f3741 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -66,7 +66,7 @@
main.commit = ( main.commit.split( " " ) )[ 1 ]
def CASE1( self, main ):
- main.testSetUp.ONOSSetUp( "localhost", main.Cluster, True, cellName=cellName )
+ main.testSetUp.ONOSSetUp( main.Cluster, True, cellName=cellName )
main.log.info( "Startup sequence complete" )
main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress, [ "ERROR", "WARNING", "EXCEPT" ], outputMode="d" )
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index b742960..f3e686f 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -96,7 +96,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
def CASE11( self, main ):
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 7be0cc3..629dad7 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -99,7 +99,7 @@
# Clean up test environment and set up
import time
main.maxNumBatch = 0
- main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
# config apps
main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg,
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 9232a73..ef1cfb9 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -110,7 +110,7 @@
import time
main.maxNumBatch = 0
- main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
configRetry = 0
main.cfgCheck = False
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 71bf1aa..f5f1f19 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -121,7 +121,7 @@
import time
main.maxNumBatch = 0
- main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
configRetry = 0
main.cfgCheck = False
diff --git a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
index e591381..4596db8 100644
--- a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
+++ b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
@@ -82,7 +82,7 @@
def CASE1( self, main ):
# Clean up test environment and set up
import time
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
try:
from tests.dependencies.utils import Utils
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index 180d860..3a6f503 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
@@ -98,7 +98,7 @@
def CASE1( self, main ):
# Clean up test environment and set up
import time
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
main.log.info( "Configure apps" )
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index b0b8880..7c5952a 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -139,7 +139,7 @@
- Connect to cli
"""
import time
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster )
+ main.testSetUp.ONOSSetUp( main.Cluster )
def CASE3( self, main ):
"""
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 1633c44..674b925 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -111,7 +111,7 @@
- Install ONOS cluster
- Connect to cli
"""
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
killRemoveMax=False )
def CASE10( self, main ):
@@ -440,6 +440,6 @@
# how many flows we installed before crash
temp += "," + str( totalFlows )
# other columns in database, but we didn't use in this test
- temp += "," + "0,0,0,0,0,0"
+ temp += "," + "0,0,0,0,0,0,0,0"
temp += "\n"
dbFile.write( temp )
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 4e230c0..74afcf8 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -109,7 +109,7 @@
except ( NameError, AttributeError ):
main.Utils = Utils()
main.maxNumBatch = 0
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
+ main.testSetUp.ONOSSetUp( main.Cluster, True,
cellName=main.cellName, killRemoveMax=False )
main.log.info( "Configure apps" )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md b/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md
new file mode 100644
index 0000000..7409f58
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/README.md
@@ -0,0 +1,19 @@
+This test verifies basic L2 connectivity using SegmentRouting via pingall
+
+It consists of
+
+1) Configure and install ONOS cluster
+2) Start Mininet and check flow state
+3) Pingall
+
+<h3>Requirements</h3>
+ - Trellis leaf-spine fabric: please visit following URL to set up Trellis leaf-spine fabric
+ https://github.com/opennetworkinglab/routing/tree/master/trellis
+ - ONOS_APPS=drivers,openflow,segmentrouting,fpm,netcfghostprovider
+
+<h3>Topologies</h3>
+- 0x1 single ToR
+- 0x2 dual-homed ToR
+- 2x2 leaf-spine
+- 2x4 leaf-spine with dual-homed ToR and dual links to spines
+- 2x3 leaf-spine with dual-homed ToR (Not implemented yet)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
new file mode 100644
index 0000000..09d8b19
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
@@ -0,0 +1,41 @@
+<PARAMS>
+ <testcases>5,6,7,8,15,16,17,18,25,26,27,28,35,36,37,38,45,46,47,48,55,56,57,58,65,66,67,68,75,76,77,78</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <topology>trellis_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py</lib>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting,openflow,fpm,netcfghostprovider</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
new file mode 100644
index 0000000..6f8c9fc
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.py
@@ -0,0 +1,1083 @@
+class SRBridging:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 1,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE2( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 2,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE3( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 3,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE4( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 4,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE5( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 5,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE6( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 6,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE7( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 7,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE8( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 8,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE11( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 11,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10 ] )
+
+ def CASE12( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 12,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10 ] )
+
+ def CASE13( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 13,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10, 20, 20 ] )
+
+ def CASE14( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 14,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10, 20, 20 ] )
+
+ def CASE15( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 15,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10 ] )
+
+ def CASE16( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 16,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10 ] )
+
+ def CASE17( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 17,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10, 20, 20 ] )
+
+ def CASE18( self, main ):
+ """
+ Tests connectivity between two tagged hosts
+ (Ports are configured as vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 18,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts",
+ vlan = [ 10, 10, 20, 20 ] )
+
+ def CASE21( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 21,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE22( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 22,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE23( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 23,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE24( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 24,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE25( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 25,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE26( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 26,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE27( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 27,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE28( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (Ports are configured as vlan-native with vlan-tagged)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 28,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts" )
+
+ def CASE31( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 31,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE32( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 32,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE33( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 33,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE34( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 34,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE35( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 35,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE36( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 36,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE37( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 37,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE38( self, main ):
+ """
+ Tests connectivity between two untagged hosts
+ (One port is configured as vlan-native with vlan-tagged,
+ another with vlan-untagged)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest(main,
+ test_idx = 38,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts, "
+ "one on vlan-untagged port and the other on vlan-native port" )
+
+ def CASE41( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 41,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10 ] )
+
+ def CASE42( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 42,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10 ] )
+
+ def CASE43( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 43,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10, 0, 20 ] )
+
+ def CASE44( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 44,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10, 0, 20 ] )
+
+ def CASE45( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 45,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10 ] )
+
+ def CASE46( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 46,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10 ] )
+
+ def CASE47( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 47,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10, 0, 20 ] )
+
+ def CASE48( self, main ):
+ """
+ Tests connectivity between untagged host and tagged host
+ (Ports are configured as vlan-untagged and
+ vlan-tagged with same vlan id, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 48,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between untagged host and tagged host",
+ vlan = [ 0, 10, 0, 20 ] )
+
+ def CASE51( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 51,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE52( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 52,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE53( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 53,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE54( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 54,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE55( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 55,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE56( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 56,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE57( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 57,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE58( self, main ):
+ """
+ Tests connectivity between two untagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 58,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two untagged hosts with different vlan id" )
+
+ def CASE61( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 61,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20 ] )
+
+ def CASE62( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 62,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20 ] )
+
+ def CASE63( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 63,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20, 30, 40 ] )
+
+ def CASE64( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 64,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20, 30, 40 ] )
+
+ def CASE65( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 65,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20 ] )
+
+ def CASE66( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 66,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20 ] )
+
+ def CASE67( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 67,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20, 30, 40 ] )
+
+ def CASE68( self, main ):
+ """
+ Tests connectivity between two tagged hosts with different vlan id
+ (Ports are configured as vlan-tagged 10 and 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x4 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 68,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between two tagged hosts with different vlan id",
+ vlan = [ 10, 20, 30, 40 ] )
+
+ def CASE71( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 71,
+ topology = '0x1',
+ onosNodes = 1,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20 ] )
+
+ def CASE72( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 72,
+ topology = '0x2',
+ onosNodes = 1,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20 ] )
+
+ def CASE73( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 73,
+ topology = '2x2',
+ onosNodes = 1,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20, 0, 40 ] )
+
+ def CASE74( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 1 ONOS instance
+ Start 2x2 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 74,
+ topology = '2x4',
+ onosNodes = 1,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20, 0, 40 ] )
+
+ def CASE75( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x1 single ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 75,
+ topology = '0x1',
+ onosNodes = 3,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20 ] )
+
+ def CASE76( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 0x2 dual-homed ToR topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 76,
+ topology = '0x2',
+ onosNodes = 3,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20 ] )
+
+ def CASE77( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x2 leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 77,
+ topology = '2x2',
+ onosNodes = 3,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20, 0, 40 ] )
+
+ def CASE78( self, main ):
+ """
+ Tests connectivity between untagged and tagged hosts with different vlan id
+ (Ports are configured as vlan-untagged 10 and vlan-tagged 20, respectively)
+
+ Sets up 3 ONOS instances
+ Start 2x2 dual-homed leaf-spine topology
+ Pingall
+ """
+ from tests.USECASE.SegmentRouting.SRBridging.dependencies.SRBridgingTest import SRBridgingTest
+ SRBridgingTest.runTest( main,
+ test_idx = 78,
+ topology = '2x4',
+ onosNodes = 3,
+ description = "Bridging test between untagged and tagged hosts with different vlan id",
+ vlan = [ 0, 20, 0, 40 ] )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo
new file mode 100644
index 0000000..a672a8e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo
@@ -0,0 +1,36 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></onos_home> # defines where onos home is
+ <nodes>3</nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <home>~/mininet/custom/</home>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
new file mode 100644
index 0000000..ac79922
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -0,0 +1,81 @@
+"""
+Copyright 2017 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ ( at your option ) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
+
+class SRBridgingTest ():
+
+ def __init__( self ):
+ self.default = ''
+
+ @staticmethod
+ def runTest( main, test_idx, topology, onosNodes, description, vlan = [] ):
+ topo = dict()
+ # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount - leaf)
+ topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 28 )
+ topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 37 )
+ topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 37 )
+ # TODO: Implement 2x3 topology
+ # topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR', 28 )
+ topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 53 )
+
+ skipPackage = False
+ init = False
+ if not hasattr( main, 'apps' ):
+ init = True
+ run.initTest( main )
+ # Skip onos packaging if the clusrer size stays the same
+ if not init and onosNodes == main.Cluster.numCtrls:
+ skipPackage = True
+
+ main.case( '%s, with %s and %d ONOS instance%s' %
+ ( description, topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
+
+ main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
+ main.configPath = main.path + "/dependencies/"
+ main.resultFileName = 'CASE%02d' % test_idx
+ main.Cluster.setRunningNode( onosNodes )
+ run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
+ if hasattr( main, 'Mininet1' ):
+ # Run the test with Mininet
+ mininet_args = ' --spine=%d --leaf=%d' % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ] )
+ if topo[ topology ][ 2 ]:
+ mininet_args += ' --dual-homed'
+ if len( vlan ) > 0 :
+ mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
+
+ run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
+ else:
+ # Run the test with physical devices
+ # TODO: connect TestON to the physical network
+ pass
+
+ run.checkFlows( main, minFlowCount=topo[ topology ][ 4 ] * topo[ topology ][ 1 ], sleep=5 )
+ leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( topo[ topology ][ 1 ] ) ]
+ for dpid in leaf_dpid:
+ run.checkFlowsByDpid( main, dpid, topo[ topology ][ 4 ], sleep=5 )
+ run.pingAll( main, 'CASE%02d' % test_idx )
+
+ if hasattr( main, 'Mininet1' ):
+ run.cleanup( main )
+ else:
+ # TODO: disconnect TestON from the physical network
+ pass
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json
new file mode 100644
index 0000000..7cbb5e1
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json
@@ -0,0 +1,34 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.json
new file mode 100644
index 0000000..f0460f9
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE02.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.json
new file mode 100644
index 0000000..6dc183a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE03.json
@@ -0,0 +1,86 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.json
new file mode 100644
index 0000000..443975d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE04.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/None": {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.json
new file mode 100644
index 0000000..42f58c3
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE11.json
@@ -0,0 +1,46 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/1"]
+ }
+ },
+ "00:aa:00:00:00:02/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/2"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.json
new file mode 100644
index 0000000..8ce1a02
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE12.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/10" : {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/10" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.json
new file mode 100644
index 0000000..7835cf3
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE13.json
@@ -0,0 +1,108 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"]
+ }
+ },
+ "00:aa:00:00:00:02/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"]
+ }
+ },
+ "00:aa:00:00:00:03/20" : {
+ "basic": {
+ "locations": ["of:0000000000000002/3"]
+ }
+ },
+ "00:aa:00:00:00:04/20" : {
+ "basic": {
+ "locations": ["of:0000000000000002/4"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.json
new file mode 100644
index 0000000..aa969dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE14.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:aa:00:00:00:02/10" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:aa:00:00:00:03/20" : {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:aa:00:00:00:04/20" : {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.json
new file mode 100644
index 0000000..391d6a8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE21.json
@@ -0,0 +1,36 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.json
new file mode 100644
index 0000000..50c4289
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE22.json
@@ -0,0 +1,84 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.json
new file mode 100644
index 0000000..26f3678
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE23.json
@@ -0,0 +1,90 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.json
new file mode 100644
index 0000000..6d39eca
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE24.json
@@ -0,0 +1,184 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/None": {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.json
new file mode 100644
index 0000000..d96fbd4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE31.json
@@ -0,0 +1,35 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.json
new file mode 100644
index 0000000..797ca0d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE32.json
@@ -0,0 +1,82 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.json
new file mode 100644
index 0000000..8752708
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE33.json
@@ -0,0 +1,88 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.json
new file mode 100644
index 0000000..c82b944
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE34.json
@@ -0,0 +1,180 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10],
+ "vlan-native": 20
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30],
+ "vlan-native": 40
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/None": {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.json
new file mode 100644
index 0000000..9940a3d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE41.json
@@ -0,0 +1,41 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:02/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/2"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.json
new file mode 100644
index 0000000..6e14c7e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE42.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/10" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.json
new file mode 100644
index 0000000..514b1fb
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE43.json
@@ -0,0 +1,98 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:02/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"]
+ }
+ },
+ "00:aa:00:00:00:04/20" : {
+ "basic": {
+ "locations": ["of:0000000000000002/4"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.chart
new file mode 100644
index 0000000..0102621
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "True",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.json
new file mode 100644
index 0000000..9579f7a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE44.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/10" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/20" : {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.json
new file mode 100644
index 0000000..ea6fc80
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE51.json
@@ -0,0 +1,34 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.json
new file mode 100644
index 0000000..170c2d7
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE52.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.json
new file mode 100644
index 0000000..f9475db
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE53.json
@@ -0,0 +1,86 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.json
new file mode 100644
index 0000000..b428fd4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE54.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 20
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 40
+ }
+ ]
+ }
+ },
+ "hosts": {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/None": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/None": {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.json
new file mode 100644
index 0000000..6f78265
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE61.json
@@ -0,0 +1,46 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/1"]
+ }
+ },
+ "00:aa:00:00:00:02/20" : {
+ "basic": {
+ "locations": ["of:0000000000000001/2"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.json
new file mode 100644
index 0000000..e030388
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE62.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/10" : {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/20" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.json
new file mode 100644
index 0000000..a971ba7
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE63.json
@@ -0,0 +1,108 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10": {
+ "basic": {
+ "locations": ["of:0000000000000001/3"]
+ }
+ },
+ "00:aa:00:00:00:02/20": {
+ "basic": {
+ "locations": ["of:0000000000000001/4"]
+ }
+ },
+ "00:aa:00:00:00:03/30": {
+ "basic": {
+ "locations": ["of:0000000000000002/3"]
+ }
+ },
+ "00:aa:00:00:00:04/40": {
+ "basic": {
+ "locations": ["of:0000000000000002/4"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.json
new file mode 100644
index 0000000..be8fa2f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE64.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [10]
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/10": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6","of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/20": {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/30": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/40": {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.json
new file mode 100644
index 0000000..6d989ad
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE71.json
@@ -0,0 +1,41 @@
+{
+ "ports" : {
+ "of:0000000000000001/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:02/20" : {
+ "basic": {
+ "locations": ["of:0000000000000001/2"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.chart
new file mode 100644
index 0000000..ff7036f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.json
new file mode 100644
index 0000000..0fcb6a4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE72.json
@@ -0,0 +1,80 @@
+{
+ "ports" : {
+ "of:0000000000000001/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/2", "of:0000000000000002/2"]
+ }
+ },
+ "00:AA:00:00:00:02/20" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/3", "of:0000000000000002/3"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 1,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.json
new file mode 100644
index 0000000..01173a0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE73.json
@@ -0,0 +1,98 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000002/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:02/20" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"]
+ }
+ },
+ "00:aa:00:00:00:04/40" : {
+ "basic": {
+ "locations": ["of:0000000000000002/4"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.chart b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.chart
new file mode 100644
index 0000000..ba520ce
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.chart
@@ -0,0 +1,6 @@
+{
+ "leaf1": {"expect": "False",
+ "hosts":["h1", "h2"]},
+ "leaf2": {"expect": "False",
+ "hosts":["h3", "h4"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.json
new file mode 100644
index 0000000..68ae34c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE74.json
@@ -0,0 +1,176 @@
+{
+ "ports" : {
+ "of:0000000000000001/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.2.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-untagged": 30
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.0.3.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:AA:00:00:00:01/None": {
+ "basic": {
+ "ips": ["10.0.2.1"],
+ "locations": ["of:0000000000000001/6", "of:0000000000000002/6"]
+ }
+ },
+ "00:AA:00:00:00:02/20" : {
+ "basic": {
+ "ips": ["10.0.2.2"],
+ "locations": ["of:0000000000000001/7", "of:0000000000000002/7"]
+ }
+ },
+ "00:AA:00:00:00:03/None": {
+ "basic": {
+ "ips": ["10.0.3.1"],
+ "locations": ["of:0000000000000003/6", "of:0000000000000004/6"]
+ }
+ },
+ "00:AA:00:00:00:04/40" : {
+ "basic": {
+ "ips": ["10.0.3.2"],
+ "locations": ["of:0000000000000003/7", "of:0000000000000004/7"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000002",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000001",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000004",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairDeviceId" : "of:0000000000000003",
+ "pairLocalPort" : 5,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
index cf284ca..23057dd 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
index 2fa1d4e..fba7e9f 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
index 9f61a70..cdb841b 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
index 93e3dbe..a5d4811 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
index cf284ca..23057dd 100755
--- a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md b/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md
new file mode 100644
index 0000000..6d461c4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md
@@ -0,0 +1,15 @@
+This test verifies basic L23 connectivity using SegmentRouting via pingall
+
+It consists of
+
+1) Configure and install ONOS cluster
+2) Start Mininet and check flow state
+3) Pingall
+
+<h3>Requirements</h3>
+ - Trellis leaf-spine fabric: please visit following URL to set up Trellis leaf-spine fabric
+ https://github.com/opennetworkinglab/routing/tree/master/trellis
+ - ONOS_APPS=drivers,openflow,segmentrouting,fpm,netcfghostprovider
+
+<h3>Topologies</h3>
+- 2x5 Comcast Topology.
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
new file mode 100644
index 0000000..ad8377e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
@@ -0,0 +1,41 @@
+<PARAMS>
+ <testcases>1</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <topology>comcast_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py,trellis_fabric.py</lib>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting,openflow,fpmi</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
new file mode 100644
index 0000000..e452901
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -0,0 +1,22 @@
+
+class SRRouting:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Ping between all ipv4 hosts in the topology.
+ """
+
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
+
+ SRRoutingTest.runTest( main,
+ test_idx = 1,
+ onosNodes = 3,
+ dhcp=0,
+ routers=0,
+ ipv4=1,
+ ipv6=0,
+ description = "Ping between all ipv4 hosts in
+ the topology")
+
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo
new file mode 100644
index 0000000..01316b6
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo
@@ -0,0 +1,36 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></onos_home> # defines where onos home is
+ <nodes>3</nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <home>~/mininet/custom/</home>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
new file mode 100644
index 0000000..c79a446
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -0,0 +1,72 @@
+"""
+Copyright 2017 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ ( at your option ) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
+
+class SRRoutingTest ():
+
+ topo = {}
+
+ def __init__( self ):
+ self.default = ''
+
+ @staticmethod
+ def runTest( main, test_idx, onosNodes, dhcp, routers, ipv4, ipv6, description):
+
+ skipPackage = False
+ init = False
+ if not hasattr( main, 'apps' ):
+ init = True
+ run.initTest( main )
+
+ # Skip onos packaging if the cluster size stays the same
+ if not init and onosNodes == main.Cluster.numCtrls:
+ skipPackage = True
+
+ main.case('%s, ONOS instance%s' %
+ (description, onosNodes))
+
+ main.cfgName = 'COMCAST_CONFIG_ipv4=%d_ipv6=%d_dhcp=%d_routers=%d' % \
+ (ipv4, ipv6, dhcp, routers)
+ main.configPath = main.path + "/dependencies/"
+ main.resultFileName = 'CASE%02d' % test_idx
+ main.Cluster.setRunningNode(onosNodes)
+
+ run.installOnos(main, skipPackage=skipPackage, cliSleep=5,
+ parallel=False)
+
+ if hasattr(main, 'Mininet1'):
+ # Run the test with Mininet
+ mininet_args = ' --dhcp=%s --routers=%s --ipv6=%s --ipv4=%s' % (dhcp, routers, ipv6, ipv4)
+ run.startMininet(main, 'comcast_fabric.py', args=mininet_args)
+ else:
+ # Run the test with physical devices
+ # TODO: connect TestON to the physical network
+ pass
+
+ # ping hosts
+ main.Network.pingAll()
+
+ if hasattr(main, 'Mininet1'):
+ run.cleanup(main)
+ else:
+ # TODO: disconnect TestON from the physical network
+ pass
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
new file mode 100644
index 0000000..8fc87ff
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
@@ -0,0 +1,4 @@
+{
+ "ipv4": {"expect": "True",
+ "hosts":["h1v4", "h2v4" ,"h3v4", "h4v4", "h5v4", "h6v4", "h7v4", "h8v4", "h9v4", "h10v4", "h11v4"]}
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
new file mode 100644
index 0000000..b4cf1dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
@@ -0,0 +1,307 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.10.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000002/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.10.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/9" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.40.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.0.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.20.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"],
+ "ips": ["10.1.0.1"]
+ }
+ },
+ "00:aa:00:00:01:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"],
+ "ips": ["10.1.10.1"]
+ }
+ },
+ "00:aa:00:00:00:02/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/6"],
+ "ips": ["10.2.0.1"]
+ }
+ },
+ "00:aa:00:00:00:03/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+ "ips": ["10.2.30.1"]
+ }
+ },
+ "00:aa:00:00:00:04/30" : {
+ "basic": {
+ "locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+ "ips": ["10.2.20.1"]
+ }
+ },
+ "00:aa:00:00:00:05/20" : {
+ "basic": {
+ "locations": ["of:0000000000000003/8"],
+ "ips": ["10.2.10.1"]
+ }
+ },
+ "00:aa:00:00:01:05/40" : {
+ "basic": {
+ "locations": ["of:0000000000000003/9"],
+ "ips": ["10.2.40.1"]
+ }
+ },
+ "00:aa:00:00:00:06/30" : {
+ "basic": {
+ "locations": ["of:0000000000000004/6"],
+ "ips": ["10.3.0.1"]
+ }
+ },
+ "00:aa:00:00:00:07/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+ "ips": ["10.3.10.1"]
+ }
+ },
+ "00:aa:00:00:00:08/40" : {
+ "basic": {
+ "locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+ "ips": ["10.3.30.1"]
+ }
+ },
+ "00:aa:00:00:00:0A/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/8"],
+ "ips": ["10.3.20.1"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "name" : "s001",
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-105
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "name" : "s002",
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000003",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-95
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "name" : "s003",
+ "ipv4NodeSid" : 3,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000002",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-90
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "name" : "s004",
+ "ipv4NodeSid" : 4,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000005",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-85
+ }
+ },
+ "of:0000000000000005" : {
+ "segmentrouting" : {
+ "name" : "s005",
+ "ipv4NodeSid" : 5,
+ "ipv4Loopback" : "192.168.0.5",
+ "routerMac" : "00:00:00:00:00:05",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000004",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-80
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "name" : "s101",
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-100
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "name" : "s102",
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-95
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
index 2fa1d4e..fba7e9f 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
index 93e3dbe..a5d4811 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
@@ -13,15 +13,12 @@
</SCALE>
<DEPENDENCY>
- <wrapper1>startUp</wrapper1>
<topology>cord_fabric.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers,segmentrouting</cellApps>
- <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
- <cellUser>sdn</cellUser>
+ <cellApps>drivers,segmentrouting,openflow-base,netcfghostprovider,netcfglinksprovider</cellApps>
</ENV>
<GIT>
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json b/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json
new file mode 100644
index 0000000..8a7eff8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json
@@ -0,0 +1,279 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000002/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.10.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.0.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.20.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"],
+ "ips": ["10.1.0.1"]
+ }
+ },
+ "00:aa:00:00:00:02/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/6"],
+ "ips": ["10.2.0.1"]
+ }
+ },
+ "00:aa:00:00:00:03/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+ "ips": ["10.2.30.1"]
+ }
+ },
+ "00:aa:00:00:00:04/30" : {
+ "basic": {
+ "locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+ "ips": ["10.2.20.1"]
+ }
+ },
+ "00:aa:00:00:00:05/20" : {
+ "basic": {
+ "locations": ["of:0000000000000003/8"],
+ "ips": ["10.2.10.1"]
+ }
+ },
+ "00:aa:00:00:00:06/30" : {
+ "basic": {
+ "locations": ["of:0000000000000004/6"],
+ "ips": ["10.3.0.1"]
+ }
+ },
+ "00:aa:00:00:00:07/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+ "ips": ["10.3.10.1"]
+ }
+ },
+ "00:aa:00:00:00:08/40" : {
+ "basic": {
+ "locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+ "ips": ["10.3.30.1"]
+ }
+ },
+ "00:aa:00:00:00:0A/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/8"],
+ "ips": ["10.3.20.1"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "name" : "s001",
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-105
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "name" : "s002",
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000003",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-95
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "name" : "s003",
+ "ipv4NodeSid" : 3,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000002",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-90
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "name" : "s004",
+ "ipv4NodeSid" : 4,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000005",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-85
+ }
+ },
+ "of:0000000000000005" : {
+ "segmentrouting" : {
+ "name" : "s005",
+ "ipv4NodeSid" : 5,
+ "ipv4Loopback" : "192.168.0.5",
+ "routerMac" : "00:00:00:00:00:05",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000004",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-80
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "name" : "s101",
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-100
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "name" : "s102",
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-95
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 07b0188..6329782 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -47,6 +47,8 @@
except ImportError:
main.log.error( "ONOSSetup not found. exiting the test" )
main.cleanAndExit()
+ from tests.dependencies.Network import Network
+ main.Network = Network()
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
@@ -54,29 +56,25 @@
# Test variables
main.cellName = main.params[ 'ENV' ][ 'cellName' ]
main.apps = main.params[ 'ENV' ][ 'cellApps' ]
- main.diff = main.params[ 'ENV' ][ 'diffApps' ]
main.path = os.path.dirname( main.testFile )
- main.dependencyPath = main.path + "/../dependencies/"
+ main.topoPath = main.path + "/../dependencies/"
+ main.configPath = main.path + "/../dependencies/"
main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
- wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ main.topologyLib = main.params[ 'DEPENDENCY' ][ 'lib' ] if 'lib' in main.params[ 'DEPENDENCY' ] else None
+ main.topologyConf = main.params[ 'DEPENDENCY' ][ 'conf' ] if 'conf' in main.params[ 'DEPENDENCY' ] else None
main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
- # main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- # -- INIT SECTION, ONLY RUNS ONCE -- #
- copyResult1 = main.ONOSbench.scp( main.Mininet1,
- main.dependencyPath +
- main.topology,
- main.Mininet1.home,
- direction="to" )
stepResult = main.testSetUp.envSetup()
except Exception as e:
main.testSetUp.envSetupException( e )
+
main.testSetUp.evnSetupConclusion( stepResult )
@staticmethod
- def installOnos( main, vlanCfg=True ):
+ def installOnos( main, vlanCfg=True, skipPackage=False, cliSleep=10,
+ parallel=True ):
"""
- Set up cell
- Create cell file
@@ -89,45 +87,18 @@
- Connect to cli
"""
# main.scale[ 0 ] determines the current number of ONOS controller
- if main.diff:
- main.apps = main.apps + "," + main.diff
- else:
+ if not main.apps:
main.log.error( "App list is empty" )
main.log.info( "NODE COUNT = " + str( main.Cluster.numCtrls ) )
main.log.info( ''.join( main.Cluster.getIps() ) )
main.dynamicHosts = [ 'in1', 'out1' ]
- main.testSetUp.createApplyCell( main.Cluster, newCell=True, cellName=main.cellName,
- Mininet=main.Mininet1, useSSH=Testcaselib.useSSH,
- ips=main.Cluster.getIps() )
- # kill off all onos processes
- main.log.info( "Safety check, killing all ONOS processes" +
- " before initiating environment setup" )
- for ctrl in main.Cluster.runningNodes:
- main.ONOSbench.onosDie( ctrl.ipAddress )
-
- main.testSetUp.buildOnos( main.Cluster )
-
- main.testSetUp.installOnos( main.Cluster, False )
-
- main.testSetUp.setupSsh( main.Cluster )
-
- main.testSetUp.checkOnosService( main.Cluster )
-
- cliResult = main.TRUE
- main.step( "Checking if ONOS CLI is ready" )
- for ctrl in main.Cluster.runningNodes:
- ctrl.CLI.startCellCli()
- cliResult = cliResult and ctrl.CLI.startOnosCli( ctrl.ipAddress,
- commandlineTimeout=60,
- onosStartTimeout=100 )
- ctrl.active = True
- utilities.assert_equals( expect=main.TRUE,
- actual=cliResult,
- onpass="ONOS CLI is ready",
- onfail="ONOS CLI is not ready" )
+ main.testSetUp.ONOSSetUp( main.Cluster, newCell=True, cellName=main.cellName,
+ skipPack=skipPackage,
+ useSSH=Testcaselib.useSSH,
+ installParallel=parallel)
ready = utilities.retry( main.Cluster.active( 0 ).CLI.summary,
main.FALSE,
- sleep=10,
+ sleep=cliSleep,
attempts=10 )
if ready:
ready = main.TRUE
@@ -135,12 +106,10 @@
onpass="ONOS summary command succeded",
onfail="ONOS summary command failed" )
- with open( "%s/json/%s.json" % (
- main.dependencyPath, main.cfgName ) ) as cfg:
- main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
- with open( "%s/json/%s.chart" % (
- main.dependencyPath, main.cfgName ) ) as chart:
- main.pingChart = json.load( chart )
+ with open( "%s/json/%s.json" % (main.configPath, main.cfgName)) as cfg:
+ main.Cluster.active( 0 ).REST.setNetCfg(json.load(cfg))
+ with open("%s/json/%s.chart" % (main.configPath, main.cfgName)) as chart:
+ main.pingChart = json.load(chart)
if not ready:
main.log.error( "ONOS startup failed!" )
main.cleanAndExit()
@@ -153,8 +122,29 @@
@staticmethod
def startMininet( main, topology, args="" ):
+ copyResult = main.ONOSbench.scp( main.Mininet1,
+ main.topoPath + main.topology,
+ main.Mininet1.home,
+ direction="to" )
+ if main.topologyLib:
+ for lib in main.topologyLib.split(","):
+ copyResult = copyResult and main.ONOSbench.scp( main.Mininet1,
+ main.topoPath + lib,
+ main.Mininet1.home,
+ direction="to" )
+ if main.topologyConf:
+ for conf in main.topologyConf.split(","):
+ copyResult = copyResult and main.ONOSbench.scp( main.Mininet1,
+ main.topoPath + "conf/" + conf,
+ "~/",
+ direction="to" )
+ stepResult = copyResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully copied topo files",
+ onfail="Failed to copy topo files" )
main.step( "Starting Mininet Topology" )
- arg = "--onos %d %s" % ( main.Cluster.numCtrls, args )
+ arg = "--onos-ip=%s %s" % (",".join([ctrl.ipAddress for ctrl in main.Cluster.runningNodes]), args)
main.topology = topology
topoResult = main.Mininet1.startNet(
topoFile=main.Mininet1.home + main.topology, args=arg )
@@ -211,14 +201,14 @@
main.cleanAndExit()
@staticmethod
- def checkFlows( main, minFlowCount, dumpflows=True ):
+ def checkFlows( main, minFlowCount, dumpflows=True, sleep=10 ):
main.step(
" Check whether the flow count is bigger than %s" % minFlowCount )
count = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowCount,
main.FALSE,
kwargs={ 'min': minFlowCount },
attempts=10,
- sleep=10 )
+ sleep=sleep )
utilities.assertEquals(
expect=True,
actual=( count > 0 ),
@@ -229,8 +219,8 @@
flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
main.FALSE,
kwargs={ 'isPENDING': False },
- attempts=2,
- sleep=10 )
+ attempts=5,
+ sleep=sleep )
utilities.assertEquals(
expect=main.TRUE,
actual=flowCheck,
@@ -240,11 +230,26 @@
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
"flows",
main.logdir,
- "flowsBefore" + main.cfgName )
+ main.resultFileName + "_FlowsBefore" )
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
"groups",
main.logdir,
- "groupsBefore" + main.cfgName )
+ main.resultFileName + "_GroupsBefore" )
+
+ @staticmethod
+ def checkFlowsByDpid( main, dpid, minFlowCount, sleep=10 ):
+ main.step(
+ " Check whether the flow count of device %s is bigger than %s" % ( dpid, minFlowCount ) )
+ count = utilities.retry( main.Cluster.active( 0 ).CLI.flowAddedCount,
+ None,
+ args=( dpid, ),
+ attempts=5,
+ sleep=sleep )
+ utilities.assertEquals(
+ expect=True,
+ actual=( int( count ) > minFlowCount ),
+ onpass="Flow count looks correct: " + count ,
+ onfail="Flow count looks wrong: " + count )
@staticmethod
def pingAll( main, tag="", dumpflows=True ):
@@ -253,9 +258,13 @@
for entry in main.pingChart.itervalues():
print entry
hosts, expect = entry[ 'hosts' ], entry[ 'expect' ]
- expect = main.TRUE if expect else main.FALSE
+ try:
+ expect = main.TRUE if str(expect).lower() == 'true' else main.FALSE
+ except:
+ expect = main.FALSE
main.step( "Connectivity for %s %s" % ( str( hosts ), tag ) )
- pa = main.Mininet1.pingallHosts( hosts )
+ pa = main.Network.pingallHosts( hosts )
+
utilities.assert_equals( expect=expect, actual=pa,
onpass="IP connectivity successfully tested",
onfail="IP connectivity failed" )
@@ -263,11 +272,11 @@
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
"flows",
main.logdir,
- "flowsOn" + tag )
+ tag + "_FlowsOn" )
main.ONOSbench.dumpONOSCmd( main.Cluster.active( 0 ).ipAddress,
"groups",
main.logdir,
- "groupsOn" + tag )
+ tag + "_GroupsOn" )
@staticmethod
def killLink( main, end1, end2, switches, links ):
@@ -278,8 +287,8 @@
"""
main.linkSleep = float( main.params[ 'timers' ][ 'LinkDiscovery' ] )
main.step( "Kill link between %s and %s" % ( end1, end2 ) )
- LinkDown = main.Mininet1.link( END1=end1, END2=end2, OPTION="down" )
- LinkDown = main.Mininet1.link( END2=end1, END1=end2, OPTION="down" )
+ LinkDown = main.Network.link( END1=end1, END2=end2, OPTION="down" )
+ LinkDown = main.Network.link( END2=end1, END1=end2, OPTION="down" )
main.log.info(
"Waiting %s seconds for link down to be discovered" % main.linkSleep )
time.sleep( main.linkSleep )
@@ -310,8 +319,8 @@
count = 0
while True:
count += 1
- main.Mininet1.link( END1=end1, END2=end2, OPTION="up" )
- main.Mininet1.link( END2=end1, END1=end2, OPTION="up" )
+ main.Network.link( END1=end1, END2=end2, OPTION="up" )
+ main.Network.link( END2=end1, END1=end2, OPTION="up" )
main.log.info(
"Waiting %s seconds for link up to be discovered" % main.linkSleep )
time.sleep( main.linkSleep )
@@ -341,7 +350,7 @@
main.switchSleep = float( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
main.step( "Kill " + switch )
main.log.info( "Stopping" + switch )
- main.Mininet1.switch( SW=switch, OPTION="stop" )
+ main.Network.switch( SW=switch, OPTION="stop" )
# todo make this repeatable
main.log.info( "Waiting %s seconds for switch down to be discovered" % (
main.switchSleep ) )
@@ -365,7 +374,7 @@
# todo make this repeatable
main.step( "Recovering " + switch )
main.log.info( "Starting" + switch )
- main.Mininet1.switch( SW=switch, OPTION="start" )
+ main.Network.switch( SW=switch, OPTION="start" )
main.log.info( "Waiting %s seconds for switch up to be discovered" % (
main.switchSleep ) )
time.sleep( main.switchSleep )
@@ -398,7 +407,7 @@
main.utils.mininetCleanup( main.Mininet1 )
- main.utils.copyKarafLog( main.cfgName )
+ main.utils.copyKarafLog( main.resultFileName, before=True )
for ctrl in main.Cluster.active():
main.ONOSbench.onosStop( ctrl.ipAddress )
@@ -526,7 +535,7 @@
"""
import json
hostCfg = {}
- with open( main.dependencyPath + "/json/extra.json" ) as template:
+ with open( main.configPath + "/json/extra.json" ) as template:
hostCfg = json.load( template )
main.pingChart[ 'ip' ][ 'hosts' ] += [ 'in1' ]
main.step( "Pushing new configuration" )
@@ -563,7 +572,7 @@
"""
import json
hostCfg = {}
- with open( main.dependencyPath + "/json/extra.json" ) as template:
+ with open( main.configPath + "/json/extra.json" ) as template:
hostCfg = json.load( template )
main.step( "Removing host configuration" )
main.pingChart[ 'ip' ][ 'expect' ] = 0
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py
new file mode 100644
index 0000000..7b4c19e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py
@@ -0,0 +1,339 @@
+#!/usr/bin/python
+import os
+import re
+from optparse import OptionParser
+from ipaddress import ip_network
+from mininet.node import RemoteController, OVSBridge, Host
+from mininet.link import TCLink
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.nodelib import NAT
+from mininet.cli import CLI
+
+from routinglib import BgpRouter, RoutedHost
+from trellislib import DhcpServer, TaggedRoutedHost, DualHomedRoutedHost, DualHomedTaggedRoutedHost, DhcpClient, Dhcp6Client, DhcpServer, Dhcp6Server
+
+# Parse command line options and dump results
+def parseOptions():
+ "Parse command line options"
+ parser = OptionParser()
+ parser.add_option( '--dhcp', dest='dhcp', type='int', default=0,
+ help='Configure hosts with dhcp or not' )
+ parser.add_option( '--routers', dest='routers', type='int', default=0,
+ help='Configure external routers or not in the topology' )
+ parser.add_option( '--ipv6', dest='ipv6', type='int', default=0,
+ help='Configure hosts with ipv6 or not' )
+ parser.add_option( '--ipv4', dest='ipv4', type='int', default=1,
+ help='Configure hosts with ipv4 or not' )
+ parser.add_option( '--onos-ip', dest='onosIp', type='str', default='',
+ help='IP address list of ONOS instances, separated by comma(,). Overrides --onos option' )
+
+ ( options, args ) = parser.parse_args()
+ return options, args
+
+opts, args = parseOptions()
+
+class DualHomedTaggedHostWithIpv4(Host):
+
+ def __init__(self, name, ip, gateway, dhcp, vlan, *args, **kwargs):
+ super(DualHomedTaggedHostWithIpv4, self).__init__(name, **kwargs)
+ self.vlanBond0 = None
+ self.bond0 = None
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+ self.vlan = vlan
+
+ def config(self, **kwargs):
+ super(DualHomedTaggedHostWithIpv4, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+
+ self.bond0 = "%s-bond0" % self.name
+ self.vlanBondIntf = "%s.%s" % (self.bond0, self.vlan)
+
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+
+ self.cmd('ip link add link %s name %s type vlan id %s' % (self.bond0,
+ self.vlanBondIntf, self.vlan))
+
+ self.cmd('ip link set up %s' % self.vlanBondIntf)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.vlanBondIntf))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ default_intf = self.defaultIntf()
+ default_intf.name = self.vlanBondIntf
+ self.nameToIntf[self.vlanBond0] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ super(DualHomedTaggedHostWithIpv4, self).terminate()
+
+class DualHomedUntaggedHostWithIpv4(Host):
+
+ def __init__(self, name, ip, gateway, dhcp, *args, **kwargs):
+ super(DualHomedUntaggedHostWithIpv4, self).__init__(name, **kwargs)
+ self.bond0 = None
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ super(DualHomedUntaggedHostWithIpv4, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+
+ self.bond0 = "%s-bond0" % self.name
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.bond0))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ default_intf = self.defaultIntf()
+ default_intf.name = self.bond0
+ self.nameToIntf[self.bond0] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ super(DualHomedUntaggedHostWithIpv4, self).terminate()
+
+class TaggedHostWithIpv4(Host):
+ '''
+ Tagged host configured with a static ip address.
+ '''
+ def __init__(self, name, ip, gateway, dhcp, vlan, *args, **kwargs):
+ super(TaggedHostWithIpv4, self).__init__(name, *args, **kwargs)
+ self.ip = ip
+ self.gateway = gateway
+ self.vlan = vlan
+ self.vlanIntf = None
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ intf = self.defaultIntf()
+ self.vlanIntf = "%s.%s" % (intf, self.vlan)
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd('ip link add link %s name %s type vlan id %s' % (intf, self.vlanIntf, self.vlan))
+ self.cmd('ip link set up %s' % self.vlanIntf)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.vlanIntf))
+ self.cmd('ip route add default via %s' % self.gateway)
+ intf.name = self.vlanIntf
+ self.nameToIntf[self.vlanIntf] = intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link remove link %s' % self.vlanIntf)
+ super(TaggedHostWithIpv4, self).terminate()
+
+
+class UnTaggedHostWithIpv4(Host):
+ '''
+ Untagged host configured with a static ip address.
+ '''
+ def __init__(self, name, ip, gateway, dhcp, *args, **kwargs):
+ super(UnTaggedHostWithIpv4, self).__init__(name, *args, **kwargs)
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ intf = self.defaultIntf()
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, intf))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ def terminate(self, **kwargs):
+ super(UnTaggedHostWithIpv4, self).terminate()
+
+class ComcastLeafSpineFabric(Topo):
+
+ spines = dict()
+ leafs = dict()
+ hosts_dict = dict()
+
+ def createIpv4Hosts(self, dhcp):
+
+ h1 = self.addHost('h1v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:01', ip='10.1.0.1',
+ gateway='10.1.0.254', dhcp=dhcp)
+ self.addLink(h1, self.leafs[0])
+ self.hosts_dict['h1v4'] = h1
+
+ h2 = self.addHost('h2v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:01:01', ip='10.1.10.1',
+ gateway='10.1.10.254', dhcp=dhcp)
+ self.addLink(h2, self.leafs[0])
+ self.hosts_dict['h2v4'] = h2
+
+ h3 = self.addHost('h3v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:02', ip='10.2.0.1',
+ gateway='10.2.0.254', dhcp=dhcp)
+ self.addLink(h3, self.leafs[1])
+ self.hosts_dict['h3v4'] = h3
+
+ h4 = self.addHost('h4v4', cls=DualHomedUntaggedHostWithIpv4,
+ mac='00:aa:00:00:00:03', ip='10.2.30.1',
+ gateway='10.2.30.254', dhcp=dhcp)
+ self.addLink(h4, self.leafs[1])
+ self.addLink(h4, self.leafs[2])
+ self.hosts_dict['h4v4'] = h4
+
+ h5 = self.addHost('h5v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:04', ip='10.2.20.1',
+ gateway='10.2.20.254', dhcp=dhcp, vlan=30)
+ self.addLink(h5, self.leafs[1])
+ self.addLink(h5, self.leafs[2])
+ self.hosts_dict['h5v4'] = h5
+
+ h6 = self.addHost('h6v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:05', ip='10.2.10.1',
+ gateway='10.2.10.254', dhcp=dhcp, vlan=20)
+ self.addLink(h6, self.leafs[2])
+ self.hosts_dict['h6v4'] = h6
+
+ h7 = self.addHost('h7v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:01:05', ip='10.2.40.1',
+ gateway='10.2.40.254', dhcp=dhcp, vlan=40)
+ self.addLink(h7, self.leafs[2])
+ self.hosts_dict['h7v4'] = h7
+
+ h8 = self.addHost('h8v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:06', ip='10.3.0.1',
+ gateway='10.3.0.254', dhcp=dhcp, vlan=30)
+ self.addLink(h8, self.leafs[3])
+ self.hosts_dict['h8v4'] = h8
+
+ h9 = self.addHost('h9v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:07', ip='10.3.10.1',
+ gateway='10.3.10.254', dhcp=dhcp, vlan=40)
+ self.addLink(h9, self.leafs[3])
+ self.addLink(h9, self.leafs[4])
+ self.hosts_dict['h9v4'] = h9
+
+ h10 = self.addHost('h10v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:08', ip='10.3.30.1',
+ gateway='10.3.30.254', dhcp=dhcp, vlan=40)
+ self.addLink(h10, self.leafs[3])
+ self.addLink(h10, self.leafs[4])
+ self.hosts_dict['h10v4'] = h10
+
+ h11 = self.addHost('h11v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:0a', ip='10.3.20.1',
+ gateway='10.3.20.254', dhcp=dhcp, vlan=40)
+ self.addLink(h11, self.leafs[4])
+ self.hosts_dict['h11v4'] = h11
+
+ return
+
+ def createIpv6Hosts(self, dhcp):
+ print("NYI")
+ return
+
+ '''
+ Creates the topology employed by Comcast which is a 2x5
+ leaf spine traffic.
+
+ S1 S2
+
+ L1 L2 L3 L4 L5
+
+ Where L2/L3 and L4/L5 are paired switches.
+ Parameters for this topology :
+ dhcp = True/False : set up dhcp servers
+ routers = True/False : set up external routers
+ '''
+ def __init__(self, dhcp=False, routers=False, ipv4=False, ipv6=False, **opts):
+ Topo.__init__(self, **opts)
+
+ # TODO: support IPv6 hosts
+ linkopts = dict( bw=10 )
+
+ spine = 2
+ leaf = 5
+
+ # Create spine switches
+ for s in range(spine):
+ self.spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+ # Create leaf switches
+ for ls in range(leaf):
+ self.leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+ # connecting leaf and spines, leafs 1-5 have double links
+ for s in range( spine ):
+ spine_switch = self.spines[s]
+
+ for ls in range( leaf ):
+ leaf_switch = self.leafs[ls]
+
+ self.addLink( spine_switch, leaf_switch, **linkopts )
+ if ls > 0:
+ self.addLink( spine_switch, leaf_switch, **linkopts )
+
+ # connect paired leafs
+ self.addLink(self.leafs[1], self.leafs[2], **linkopts)
+ self.addLink(self.leafs[3], self.leafs[4], **linkopts)
+
+ # create hosts
+ if ipv6:
+ self.createIpv6Hosts(dhcp)
+
+ if ipv4:
+ self.createIpv4Hosts(dhcp)
+
+ if not ipv4 and not ipv6:
+ print("No hosts were created!")
+
+def config( opts ):
+
+ dhcp = bool(opts.dhcp)
+ routers = bool(opts.routers)
+ ipv6 = bool(opts.ipv6)
+ ipv4 = bool(opts.ipv4)
+
+ if opts.onosIp != '':
+ controllers = opts.onosIp.split( ',' )
+ else:
+ controllers = ['127.0.0.1']
+ topo = ComcastLeafSpineFabric(dhcp=dhcp, routers=routers, ipv6=ipv6,
+ ipv4=ipv4)
+
+ net = Mininet( topo=topo, link=TCLink, build=False,
+ controller=None, autoSetMacs=True )
+ i = 0
+ for ip in controllers:
+ net.addController( "c%s" % ( i ), controller=RemoteController, ip=ip )
+ i += 1
+
+ net.build()
+ net.start()
+ CLI( net )
+ net.stop()
+
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ config(opts)
+ os.system('sudo mn -c')
+
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp1.conf
new file mode 100644
index 0000000..8870fb4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp1.conf
@@ -0,0 +1,81 @@
+log file /var/log/quagga/bgpdbgp1.log
+hostname bgp1
+password quagga
+!
+! Different next hop for IPv4
+!
+ip prefix-list 1 seq 10 permit 10.0.2.0/24
+ip prefix-list 1 seq 20 permit 10.1.2.0/24
+ip prefix-list 1 seq 30 permit 10.0.3.0/24
+ip prefix-list 1 seq 40 permit 10.0.4.0/24
+!
+route-map NEXTHOP41 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.1.254
+!
+!
+route-map NEXTHOP47 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.7.254
+!
+! Different next hop for IPv6
+!
+ipv6 prefix-list 2 seq 10 permit 2000::200/120
+ipv6 prefix-list 2 seq 20 permit 2000::300/120
+!
+route-map NEXTHOP61 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::1ff
+set ipv6 next-hop local 2000::1ff
+!
+!
+route-map NEXTHOP67 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::7ff
+set ipv6 next-hop local 2000::7ff
+!
+! Basic router config
+!
+router bgp 65003
+bgp router-id 172.16.0.3
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.1.1 remote-as 65001
+neighbor 10.0.1.1 ebgp-multihop
+neighbor 10.0.1.1 timers connect 5
+neighbor 10.0.1.1 advertisement-interval 5
+neighbor 10.0.1.1 route-map NEXTHOP41 out
+!
+neighbor 2000::101 remote-as 65001
+neighbor 2000::101 timers connect 5
+neighbor 2000::101 advertisement-interval 1
+no neighbor 2000::101 activate
+!
+neighbor 10.0.7.1 remote-as 65002
+neighbor 10.0.7.1 ebgp-multihop
+neighbor 10.0.7.1 timers connect 5
+neighbor 10.0.7.1 advertisement-interval 5
+neighbor 10.0.7.1 route-map NEXTHOP47 out
+!
+neighbor 2000::701 remote-as 65002
+neighbor 2000::701 timers connect 5
+neighbor 2000::701 advertisement-interval 1
+no neighbor 2000::701 activate
+!
+network 10.0.2.0/24
+network 10.1.2.0/24
+network 10.0.3.0/24
+network 10.0.4.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::200/120
+network 2000::300/120
+neighbor 2000::101 activate
+neighbor 2000::101 route-map NEXTHOP61 out
+neighbor 2000::701 activate
+neighbor 2000::701 route-map NEXTHOP67 out
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp2.conf
new file mode 100644
index 0000000..e554de4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdbgp2.conf
@@ -0,0 +1,81 @@
+log file /var/log/quagga/bgpdbgp2.log
+hostname bgp2
+password quagga
+!
+! Different next hop for IPv4
+!
+ip prefix-list 1 seq 10 permit 10.0.2.0/24
+ip prefix-list 1 seq 20 permit 10.1.2.0/24
+ip prefix-list 1 seq 30 permit 10.0.3.0/24
+ip prefix-list 1 seq 40 permit 10.0.4.0/24
+!
+route-map NEXTHOP45 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.5.254
+!
+!
+route-map NEXTHOP46 permit 10
+match ip address prefix-list 1
+set ip next-hop 10.0.6.254
+!
+! Different next hop for IPv6
+!
+ipv6 prefix-list 2 seq 10 permit 2000::200/120
+ipv6 prefix-list 2 seq 20 permit 2000::300/120
+!
+route-map NEXTHOP65 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::5ff
+set ipv6 next-hop local 2000::5ff
+!
+!
+route-map NEXTHOP66 permit 10
+match ipv6 address prefix-list 2
+set ipv6 next-hop global 2000::6ff
+set ipv6 next-hop local 2000::6ff
+!
+! Basic router config
+!
+router bgp 65003
+bgp router-id 172.16.0.4
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.5.1 remote-as 65001
+neighbor 10.0.5.1 ebgp-multihop
+neighbor 10.0.5.1 timers connect 5
+neighbor 10.0.5.1 advertisement-interval 5
+neighbor 10.0.5.1 route-map NEXTHOP45 out
+!
+neighbor 2000::501 remote-as 65001
+neighbor 2000::501 timers connect 5
+neighbor 2000::501 advertisement-interval 1
+no neighbor 2000::501 activate
+!
+neighbor 10.0.6.1 remote-as 65002
+neighbor 10.0.6.1 ebgp-multihop
+neighbor 10.0.6.1 timers connect 5
+neighbor 10.0.6.1 advertisement-interval 5
+neighbor 10.0.6.1 route-map NEXTHOP46 out
+!
+neighbor 2000::601 remote-as 65002
+neighbor 2000::601 timers connect 5
+neighbor 2000::601 advertisement-interval 1
+no neighbor 2000::601 activate
+!
+network 10.0.2.0/24
+network 10.1.2.0/24
+network 10.0.3.0/24
+network 10.0.4.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::200/120
+network 2000::300/120
+neighbor 2000::501 activate
+neighbor 2000::501 route-map NEXTHOP65 out
+neighbor 2000::601 activate
+neighbor 2000::601 route-map NEXTHOP66 out
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr1.conf
new file mode 100644
index 0000000..9e526b8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr1.conf
@@ -0,0 +1,42 @@
+log file /var/log/quagga/bgpdr1.log
+hostname r1
+password quagga
+!
+! Basic router config
+!
+router bgp 65001
+bgp router-id 10.0.1.1
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.1.2 remote-as 65003
+neighbor 10.0.1.2 ebgp-multihop
+neighbor 10.0.1.2 timers connect 5
+neighbor 10.0.1.2 advertisement-interval 5
+!
+neighbor 2000::102 remote-as 65003
+neighbor 2000::102 timers connect 5
+neighbor 2000::102 advertisement-interval 1
+no neighbor 2000::102 activate
+!
+neighbor 10.0.5.2 remote-as 65003
+neighbor 10.0.5.2 ebgp-multihop
+neighbor 10.0.5.2 timers connect 5
+neighbor 10.0.5.2 advertisement-interval 5
+!
+neighbor 2000::502 remote-as 65003
+neighbor 2000::502 timers connect 5
+neighbor 2000::502 advertisement-interval 1
+no neighbor 2000::502 activate
+!
+network 10.0.99.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::7700/120
+network 2000::9900/120
+neighbor 2000::102 activate
+neighbor 2000::502 activate
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr2.conf
new file mode 100644
index 0000000..49553e2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/bgpdr2.conf
@@ -0,0 +1,42 @@
+log file /var/log/quagga/bgpdr2.log
+hostname r2
+password quagga
+!
+! Basic router config
+!
+router bgp 65002
+bgp router-id 10.0.6.1
+timers bgp 3 9
+!
+! IPv4
+!
+neighbor 10.0.6.2 remote-as 65003
+neighbor 10.0.6.2 ebgp-multihop
+neighbor 10.0.6.2 timers connect 5
+neighbor 10.0.6.2 advertisement-interval 5
+!
+neighbor 2000::602 remote-as 65003
+neighbor 2000::602 timers connect 5
+neighbor 2000::602 advertisement-interval 1
+no neighbor 2000::602 activate
+!
+neighbor 10.0.7.2 remote-as 65003
+neighbor 10.0.7.2 ebgp-multihop
+neighbor 10.0.7.2 timers connect 5
+neighbor 10.0.7.2 advertisement-interval 5
+!
+neighbor 2000::702 remote-as 65003
+neighbor 2000::702 timers connect 5
+neighbor 2000::702 advertisement-interval 1
+no neighbor 2000::702 activate
+!
+network 10.0.99.0/24
+!
+! IPv6
+!
+address-family ipv6
+network 2000::8800/120
+network 2000::9900/120
+neighbor 2000::602 activate
+neighbor 2000::702 activate
+exit-address-family
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd.conf
new file mode 100644
index 0000000..aa559d2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd.conf
@@ -0,0 +1,55 @@
+ddns-update-style none;
+
+default-lease-time 600;
+max-lease-time 7200;
+
+option domain-name-servers 8.8.8.8, 8.8.4.4;
+option domain-name "trellis.local";
+
+subnet 10.0.2.0 netmask 255.255.255.0 {
+ range 10.0.2.100 10.0.2.240;
+ option routers 10.0.2.254;
+}
+
+subnet 10.1.2.0 netmask 255.255.255.0 {
+ range 10.1.2.100 10.1.2.240;
+ option routers 10.1.2.254;
+}
+
+subnet 10.0.3.0 netmask 255.255.255.0 {
+ range 10.0.3.100 10.0.3.240;
+ option routers 10.0.3.254;
+}
+
+subnet 10.0.4.0 netmask 255.255.255.0 {
+ range 10.0.4.100 10.0.4.240;
+ option routers 10.0.4.254;
+}
+
+subnet 10.0.99.3 netmask 255.255.255.255 {
+}
+
+host h1 {
+ hardware ethernet 00:aa:00:00:00:01;
+ fixed-address 10.0.2.1;
+}
+
+host h2 {
+ hardware ethernet 00:aa:00:00:00:02;
+ fixed-address 10.0.2.2;
+}
+
+host h3 {
+ hardware ethernet 00:aa:00:00:00:03;
+ fixed-address 10.0.3.1;
+}
+
+host h4 {
+ hardware ethernet 00:aa:00:00:00:04;
+ fixed-address 10.0.3.2;
+}
+
+host dh1 {
+ hardware ethernet 00:cc:00:00:00:01;
+ fixed-address 10.1.2.1;
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd6.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd6.conf
new file mode 100644
index 0000000..526de85
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/dhcpd6.conf
@@ -0,0 +1,37 @@
+default-lease-time 600;
+max-lease-time 7200;
+
+option dhcp6.next-hop code 242 = ip6-address;
+
+subnet6 2000::200/120 {
+ range6 2000::260 2000::2fe;
+ option dhcp6.next-hop 2000::02ff;
+}
+
+subnet6 2000::300/120 {
+ range6 2000::360 2000::3fe;
+ option dhcp6.next-hop 2000::03ff;
+}
+
+subnet6 2000::9903/128 {
+}
+
+host h1v6 {
+ hardware ethernet 00:bb:00:00:00:01;
+ fixed-address6 2000::201;
+}
+
+host h2v6 {
+ hardware ethernet 00:bb:00:00:00:02;
+ fixed-address6 2000::202;
+}
+
+host h3v6 {
+ hardware ethernet 00:bb:00:00:00:03;
+ fixed-address6 2000::301;
+}
+
+host h4v6 {
+ hardware ethernet 00:bb:00:00:00:04;
+ fixed-address6 2000::302;
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp1.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp1.conf
new file mode 100644
index 0000000..51991a4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp1.conf
@@ -0,0 +1,9 @@
+log file /var/log/quagga/zebradbgp1.log
+hostname zebra-bgp1
+password quagga
+!
+! Default route via virtual management switch
+!
+ip route 0.0.0.0/0 172.16.0.1
+!
+fpm connection ip 192.168.56.11 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp2.conf b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp2.conf
new file mode 100644
index 0000000..dce218d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/conf/zebradbgp2.conf
@@ -0,0 +1,9 @@
+log file /var/log/quagga/zebradbgp2.log
+hostname zebra-bgp2
+password quagga
+!
+! Default route via virtual management switch
+!
+ip route 0.0.0.0/0 172.16.0.1
+!
+fpm connection ip 192.168.56.11 port 2620
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py
new file mode 100644
index 0000000..81ed5ec
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/routinglib.py
@@ -0,0 +1,677 @@
+#!/usr/bin/python
+
+"""
+Libraries for creating L3 topologies with routing protocols.
+"""
+
+from mininet.node import Host, OVSBridge
+from mininet.nodelib import NAT
+from mininet.log import info, debug, error
+from mininet.cli import CLI
+from ipaddress import ip_network, ip_address, ip_interface
+import os
+
+class RoutedHost(Host):
+ """Host that can be configured with multiple IP addresses."""
+ def __init__(self, name, ips, gateway, *args, **kwargs):
+ super(RoutedHost, self).__init__(name, *args, **kwargs)
+
+ self.ips = ips
+ self.gateway = gateway
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+ for ip in self.ips:
+ self.cmd('ip addr add %s dev %s' % (ip, self.defaultIntf()))
+
+ self.cmd('ip route add default via %s' % self.gateway)
+
+class RoutedHost6(Host):
+ """Host that can be configured with multiple IP addresses."""
+ def __init__(self, name, ips, gateway, *args, **kwargs):
+ super(RoutedHost6, self).__init__(name, *args, **kwargs)
+
+ self.ips = ips
+ self.gateway = gateway
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ self.cmd('ip -6 addr flush dev %s' % self.defaultIntf())
+ for ip in self.ips:
+ self.cmd('ip -6 addr add %s dev %s' % (ip, self.defaultIntf()))
+
+ self.cmd('ip -6 route add default via %s' % self.gateway)
+
+class Router(Host):
+
+ """An L3 router.
+ Configures the Linux kernel for L3 forwarding and supports rich interface
+ configuration of IP addresses, MAC addresses and VLANs."""
+
+ def __init__(self, name, interfaces, *args, **kwargs):
+ super(Router, self).__init__(name, **kwargs)
+
+ self.interfaces = interfaces
+
+ def config(self, **kwargs):
+ super(Host, self).config(**kwargs)
+
+ self.cmd('sysctl net.ipv4.ip_forward=1')
+ self.cmd('sysctl net.ipv4.conf.all.rp_filter=0')
+ self.cmd('sysctl net.ipv6.conf.all.forwarding=1')
+
+ for intf, configs in self.interfaces.items():
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd( 'sysctl net.ipv4.conf.%s.rp_filter=0' % intf )
+
+ if not isinstance(configs, list):
+ configs = [configs]
+
+ for attrs in configs:
+ # Configure the vlan if there is one
+ if 'vlan' in attrs:
+ vlanName = '%s.%s' % (intf, attrs['vlan'])
+ self.cmd('ip link add link %s name %s type vlan id %s' %
+ (intf, vlanName, attrs['vlan']))
+ self.cmd('ip link set %s up' % vlanName)
+ addrIntf = vlanName
+ else:
+ addrIntf = intf
+
+ # Now configure the addresses on the vlan/native interface
+ if 'mac' in attrs:
+ self.cmd('ip link set %s down' % addrIntf)
+ self.cmd('ip link set %s address %s' % (addrIntf, attrs['mac']))
+ self.cmd('ip link set %s up' % addrIntf)
+ for addr in attrs['ipAddrs']:
+ self.cmd('ip addr add %s dev %s' % (addr, addrIntf))
+
+class QuaggaRouter(Router):
+
+ """Runs Quagga to create a router that can speak routing protocols."""
+
+ binDir = '/usr/lib/quagga'
+ logDir = '/var/log/quagga'
+
+ def __init__(self, name, interfaces,
+ defaultRoute=None,
+ zebraConfFile=None,
+ protocols= [],
+ fpm=None,
+ runDir='/var/run/quagga', *args, **kwargs):
+ super(QuaggaRouter, self).__init__(name, interfaces, **kwargs)
+
+ self.protocols = protocols
+ self.fpm = fpm
+
+ for p in self.protocols:
+ p.setQuaggaRouter(self)
+
+ self.runDir = runDir
+ self.defaultRoute = defaultRoute
+
+ # Ensure required directories exist
+ try:
+ original_umask = os.umask(0)
+ if (not os.path.isdir(QuaggaRouter.logDir)):
+ os.makedirs(QuaggaRouter.logDir, 0777)
+ if (not os.path.isdir(self.runDir)):
+ os.makedirs(self.runDir, 0777)
+ finally:
+ os.umask(original_umask)
+
+ self.zebraConfFile = zebraConfFile
+ if (self.zebraConfFile is None):
+ self.zebraConfFile = '%s/zebrad%s.conf' % (self.runDir, self.name)
+ self.generateZebra()
+
+ self.socket = '%s/zebra%s.api' % (self.runDir, self.name)
+
+ self.zebraPidFile = '%s/zebra%s.pid' % (self.runDir, self.name)
+
+ def generateZebra(self):
+ configFile = open(self.zebraConfFile, 'w+')
+ configFile.write('log file %s/zebrad%s.log\n' % (QuaggaRouter.logDir, self.name))
+ configFile.write('hostname zebra-%s\n' % self.name)
+ configFile.write('password %s\n' % 'quagga')
+ if (self.fpm is not None):
+ configFile.write('fpm connection ip %s port 2620' % self.fpm)
+ configFile.close()
+
+ def config(self, **kwargs):
+ super(QuaggaRouter, self).config(**kwargs)
+
+ self.cmd('%s/zebra -d -f %s -z %s -i %s'
+ % (QuaggaRouter.binDir, self.zebraConfFile, self.socket, self.zebraPidFile))
+
+ for p in self.protocols:
+ p.config(**kwargs)
+
+ if self.defaultRoute:
+ self.cmd('ip route add default via %s' % self.defaultRoute)
+
+ def terminate(self, **kwargs):
+ self.cmd("ps ax | grep '%s' | awk '{print $1}' | xargs kill"
+ % (self.socket))
+
+ for p in self.protocols:
+ p.terminate(**kwargs)
+
+ super(QuaggaRouter, self).terminate()
+
+class Protocol(object):
+
+ """Base abstraction of a protocol that the QuaggaRouter can run."""
+
+ def setQuaggaRouter(self, qr):
+ self.qr = qr
+
+ def config(self, **kwargs):
+ pass
+
+ def terminate(self, **kwargs):
+ pass
+
+class BgpProtocol(Protocol):
+
+ """Configures and runs the BGP protocol in Quagga."""
+
+ def __init__(self, configFile=None, asNum=None, neighbors=[], routes=[], *args, **kwargs):
+ self.configFile = configFile
+
+ self.asNum = asNum
+ self.neighbors = neighbors
+ self.routes = routes
+
+ def config(self, **kwargs):
+ if self.configFile is None:
+ self.configFile = '%s/bgpd%s.conf' % (self.qr.runDir, self.qr.name)
+ self.generateConfig()
+
+ bgpdPidFile = '%s/bgpd%s.pid' % (self.qr.runDir, self.qr.name)
+
+ self.qr.cmd('%s/bgpd -d -f %s -z %s -i %s'
+ % (QuaggaRouter.binDir, self.configFile, self.qr.socket, bgpdPidFile))
+
+ def generateConfig(self):
+ conf = ConfigurationWriter(self.configFile)
+
+ def getRouterId(interfaces):
+ intfAttributes = interfaces.itervalues().next()
+ print intfAttributes
+ if isinstance(intfAttributes, list):
+ # Try use the first set of attributes, but if using vlans they might not have addresses
+ intfAttributes = intfAttributes[1] if not intfAttributes[0]['ipAddrs'] else intfAttributes[0]
+ return intfAttributes['ipAddrs'][0].split('/')[0]
+
+ conf.writeLine('log file %s/bgpd%s.log' % (QuaggaRouter.logDir, self.qr.name))
+ conf.writeLine('hostname bgp-%s' % self.qr.name)
+ conf.writeLine('password %s' % 'quagga')
+ conf.writeLine('!')
+ conf.writeLine('router bgp %s' % self.asNum)
+
+ conf.indent()
+
+ conf.writeLine('bgp router-id %s' % getRouterId(self.qr.interfaces))
+ conf.writeLine('timers bgp %s' % '3 9')
+ conf.writeLine('!')
+
+ for neighbor in self.neighbors:
+ conf.writeLine('neighbor %s remote-as %s' % (neighbor['address'], neighbor['as']))
+ conf.writeLine('neighbor %s ebgp-multihop' % neighbor['address'])
+ conf.writeLine('neighbor %s timers connect %s' % (neighbor['address'], '5'))
+ conf.writeLine('neighbor %s advertisement-interval %s' % (neighbor['address'], '5'))
+ if 'port' in neighbor:
+ conf.writeLine('neighbor %s port %s' % (neighbor['address'], neighbor['port']))
+ conf.writeLine('!')
+
+ for route in self.routes:
+ conf.writeLine('network %s' % route)
+
+ conf.close()
+
+class OspfProtocol(Protocol):
+
+ """Configures and runs the OSPF protocol in Quagga."""
+
+ def __init__(self, configFile=None, *args, **kwargs):
+ self.configFile = configFile
+
+ def config(self, **kwargs):
+ if self.configFile is None:
+ self.configFile = '%s/ospfd%s.conf' % (self.qr.runDir, self.qr.name)
+ self.generateConfig()
+
+ ospfPidFile = '%s/ospf%s.pid' % (self.qr.runDir, self.qr.name)
+
+ self.qr.cmd('%s/ospfd -d -f %s -z %s -i %s'
+ % (QuaggaRouter.binDir, self.configFile, self.qr.socket, ospfPidFile))
+
+ def generateConfig(self):
+ conf = ConfigurationWriter(self.configFile)
+
+ def getRouterId(interfaces):
+ intfAttributes = interfaces.itervalues().next()
+ print intfAttributes
+ if isinstance(intfAttributes, list):
+ # Try use the first set of attributes, but if using vlans they might not have addresses
+ intfAttributes = intfAttributes[1] if not intfAttributes[0]['ipAddrs'] else intfAttributes[0]
+ return intfAttributes['ipAddrs'][0].split('/')[0]
+
+ conf.writeLine('hostname ospf-%s' % self.qr.name)
+ conf.writeLine('password %s' % 'hello')
+ conf.writeLine('!')
+ conf.writeLine('router ospf')
+
+ conf.indent()
+
+ conf.writeLine('ospf router-id %s' % getRouterId(self.qr.interfaces))
+ conf.writeLine('!')
+
+ for name, intf in self.qr.interfaces.items():
+ for ip in intf['ipAddrs']:
+ conf.writeLine('network %s area 0' % ip)
+ # if intf['ipAddrs'][0].startswith('192.168'):
+ # writeLine(1, 'passive-interface %s' % name)
+
+ conf.close()
+
+class PimProtocol(Protocol):
+
+ """Configures and runs the PIM protcol in Quagga."""
+
+ def __init__(self, configFile=None, *args, **kwargs):
+ self.configFile = configFile
+
+ def config(self, **kwargs):
+ pimPidFile = '%s/pim%s.pid' % (self.qr.runDir, self.qr.name)
+
+ self.qr.cmd('%s/pimd -Z -d -f %s -z %s -i %s'
+ % (QuaggaRouter.binDir, self.configFile, self.qr.socket, pimPidFile))
+
+class ConfigurationWriter(object):
+
+ """Utility class for writing a configuration file."""
+
+ def __init__(self, filename):
+ self.filename = filename
+ self.indentValue = 0
+
+ self.configFile = open(self.filename, 'w+')
+
+ def indent(self):
+ self.indentValue += 1
+
+ def unindent(self):
+ if (self.indentValue > 0):
+ self.indentValue -= 1
+
+ def write(self, string):
+ self.configFile.write(string)
+
+ def writeLine(self, string):
+ intentStr = ''
+ for _ in range(0, self.indentValue):
+ intentStr += ' '
+ self.write('%s%s\n' % (intentStr, string))
+
+ def close(self):
+ self.configFile.close()
+
+# Backward compatibility for BGP-only use case
+class BgpRouter(QuaggaRouter):
+
+ """Quagga router running the BGP protocol."""
+
+ def __init__(self, name, interfaces,
+ asNum=0, neighbors=[], routes=[],
+ defaultRoute=None,
+ quaggaConfFile=None,
+ zebraConfFile=None,
+ *args, **kwargs):
+ bgp = BgpProtocol(configFile=quaggaConfFile, asNum=asNum, neighbors=neighbors, routes=routes)
+
+ super(BgpRouter, self).__init__(name, interfaces,
+ zebraConfFile=zebraConfFile,
+ defaultRoute=defaultRoute,
+ protocols=[bgp],
+ *args, **kwargs)
+
+class RouterData(object):
+
+ """Internal data structure storing information about a router."""
+
+ def __init__(self, index):
+ self.index = index
+ self.neighbors = []
+ self.interfaces = {}
+ self.switches = []
+
+ def addNeighbor(self, theirAddress, theirAsNum):
+ self.neighbors.append({'address': theirAddress.ip, 'as': theirAsNum})
+
+ def addInterface(self, intf, vlan, address):
+ if intf not in self.interfaces:
+ self.interfaces[intf] = InterfaceData(intf)
+
+ self.interfaces[intf].addAddress(vlan, address)
+
+ def setSwitch(self, switch):
+ self.switches.append(switch)
+
+class InterfaceData(object):
+
+ """Internal data structure storing information about an interface."""
+
+ def __init__(self, number):
+ self.number = number
+ self.addressesByVlan = {}
+
+ def addAddress(self, vlan, address):
+ if vlan not in self.addressesByVlan:
+ self.addressesByVlan[vlan] = []
+
+ self.addressesByVlan[vlan].append(address.with_prefixlen)
+
+class RoutedNetwork(object):
+
+ """Creates a host behind a router. This is common boilerplate topology
+ segment in routed networks."""
+
+ @staticmethod
+ def build(topology, router, hostName, networks):
+ # There's a convention that the router's addresses are already set up,
+ # and it has the last address in the network.
+
+ def getFirstAddress(network):
+ return '%s/%s' % (network[1], network.prefixlen)
+
+ defaultRoute = AutonomousSystem.getLastAddress(networks[0]).ip
+
+ host = topology.addHost(hostName, cls=RoutedHost,
+ ips=[getFirstAddress(network) for network in networks],
+ gateway=defaultRoute)
+
+ topology.addLink(router, host)
+
+class AutonomousSystem(object):
+
+ """Base abstraction of an autonomous system, which implies some internal
+ topology and connections to other topology elements (switches/other ASes)."""
+
+ psIdx = 1
+
+ def __init__(self, asNum, numRouters):
+ self.asNum = asNum
+ self.numRouters = numRouters
+ self.routers = {}
+ for i in range(1, numRouters + 1):
+ self.routers[i] = RouterData(i)
+
+ self.routerNodes = {}
+
+ self.neighbors = []
+ self.vlanAddresses = {}
+
+ def peerWith(self, myRouter, myAddress, theirAddress, theirAsNum, intf=1, vlan=None):
+ router = self.routers[myRouter]
+
+ router.addInterface(intf, vlan, myAddress)
+ router.addNeighbor(theirAddress, theirAsNum)
+
+ def getRouter(self, i):
+ return self.routerNodes[i]
+
+ @staticmethod
+ def generatePeeringAddresses():
+ network = ip_network(u'10.0.%s.0/24' % AutonomousSystem.psIdx)
+ AutonomousSystem.psIdx += 1
+
+ return ip_interface('%s/%s' % (network[1], network.prefixlen)), \
+ ip_interface('%s/%s' % (network[2], network.prefixlen))
+
+ @staticmethod
+ def addPeering(as1, as2, router1=1, router2=1, intf1=1, intf2=1, address1=None, address2=None, useVlans=False):
+ vlan = AutonomousSystem.psIdx if useVlans else None
+
+ if address1 is None or address2 is None:
+ (address1, address2) = AutonomousSystem.generatePeeringAddresses()
+
+ as1.peerWith(router1, address1, address2, as2.asNum, intf=intf1, vlan=vlan)
+ as2.peerWith(router2, address2, address1, as1.asNum, intf=intf2, vlan=vlan)
+
+ @staticmethod
+ def getLastAddress(network):
+ return ip_interface(network.network_address + network.num_addresses - 2)
+
+ @staticmethod
+ def getIthAddress(network, i):
+ return ip_interface('%s/%s' % (network[i], network.prefixlen))
+
+class BasicAutonomousSystem(AutonomousSystem):
+
+ """Basic autonomous system containing one host and one or more routers
+ which peer with other ASes."""
+
+ def __init__(self, num, routes, numRouters=1):
+ super(BasicAutonomousSystem, self).__init__(65000+num, numRouters)
+ self.num = num
+ self.routes = routes
+
+ def addLink(self, switch, router=1):
+ self.routers[router].setSwitch(switch)
+
+ def build(self, topology):
+ self.addRouterAndHost(topology)
+
+ def addRouterAndHost(self, topology):
+
+ # TODO implementation is messy and needs to be cleaned up
+
+ intfs = {}
+
+ router = self.routers[1]
+ for i, router in self.routers.items():
+
+ # routerName = 'r%i%i' % (self.num, i)
+ routerName = 'r%i' % self.num
+ if not i == 1:
+ routerName += ('%i' % i)
+
+ hostName = 'h%i' % self.num
+
+ for j, interface in router.interfaces.items():
+ nativeAddresses = interface.addressesByVlan.pop(None, [])
+ peeringIntf = [{'mac' : '00:00:%02x:00:%02x:%02x' % (self.num, i, j),
+ 'ipAddrs' : nativeAddresses}]
+
+ for vlan, addresses in interface.addressesByVlan.items():
+ peeringIntf.append({'vlan': vlan,
+ 'mac': '00:00:%02x:%02x:%02x:%02x' % (self.num, vlan, i, j),
+ 'ipAddrs': addresses})
+
+ intfs.update({'%s-eth%s' % (routerName, j-1) : peeringIntf})
+
+ # Only add the host to the first router for now
+ if i == 1:
+ internalAddresses = []
+ for route in self.routes:
+ internalAddresses.append('%s/%s' % (AutonomousSystem.getLastAddress(route).ip, route.prefixlen))
+
+ internalIntf = {'ipAddrs' : internalAddresses}
+
+ # This is the configuration of the next interface after all the peering interfaces
+ intfs.update({'%s-eth%s' % (routerName, len(router.interfaces.keys())) : internalIntf})
+
+ routerNode = topology.addHost(routerName,
+ asNum=self.asNum, neighbors=router.neighbors,
+ routes=self.routes,
+ cls=BgpRouter, interfaces=intfs)
+
+ self.routerNodes[i] = routerNode
+
+ for switch in router.switches:
+ topology.addLink(switch, routerNode)
+
+ # Only add the host to the first router for now
+ if i == 1:
+ defaultRoute = internalAddresses[0].split('/')[0]
+
+ host = topology.addHost(hostName, cls=RoutedHost,
+ ips=[self.getFirstAddress(route) for route in self.routes],
+ gateway=defaultRoute)
+
+ topology.addLink(routerNode, host)
+
+ # def getLastAddress(self, network):
+ # return ip_address(network.network_address + network.num_addresses - 2)
+
+ def getFirstAddress(self, network):
+ return '%s/%s' % (network[1], network.prefixlen)
+
+# TODO fix this AS - doesn't currently work
+class RouteServerAutonomousSystem(BasicAutonomousSystem):
+
+ def __init__(self, routerAddress, *args, **kwargs):
+ BasicAutonomousSystem.__init__(self, *args, **kwargs)
+
+ self.routerAddress = routerAddress
+
+ def build(self, topology, connectAtSwitch):
+
+ switch = topology.addSwitch('as%isw' % self.num, cls=OVSBridge)
+
+ self.addRouterAndHost(topology, self.routerAddress, switch)
+
+ rsName = 'rs%i' % self.num
+ routeServer = topology.addHost(rsName,
+ self.asnum, self.neighbors,
+ cls=BgpRouter,
+ interfaces={'%s-eth0' % rsName : {'ipAddrs': [self.peeringAddress]}})
+
+ topology.addLink(routeServer, switch)
+ topology.addLink(switch, connectAtSwitch)
+
+class SdnAutonomousSystem(AutonomousSystem):
+
+ """Runs the internal BGP speakers needed for ONOS routing apps like
+ SDN-IP."""
+
+ routerIdx = 1
+
+ def __init__(self, onosIps, num=1, numBgpSpeakers=1, asNum=65000, externalOnos=True,
+ peerIntfConfig=None, withFpm=False):
+ super(SdnAutonomousSystem, self).__init__(asNum, numBgpSpeakers)
+ self.onosIps = onosIps
+ self.num = num
+ self.numBgpSpeakers = numBgpSpeakers
+ self.peerIntfConfig = peerIntfConfig
+ self.withFpm = withFpm
+ self.externalOnos = externalOnos
+ self.internalPeeringSubnet = ip_network(u'1.1.1.0/24')
+
+ for router in self.routers.values():
+ # Add iBGP sessions to ONOS nodes
+ for onosIp in onosIps:
+ router.neighbors.append({'address': onosIp, 'as': asNum, 'port': 2000})
+
+ # Add iBGP sessions to other BGP speakers
+ for i, router2 in self.routers.items():
+ if router == router2:
+ continue
+ cpIpBase = self.num*10
+ ip = AutonomousSystem.getIthAddress(self.internalPeeringSubnet, cpIpBase+i)
+ router.neighbors.append({'address': ip.ip, 'as': asNum})
+
+ def build(self, topology, connectAtSwitch, controlSwitch):
+
+ natIp = AutonomousSystem.getLastAddress(self.internalPeeringSubnet)
+
+ for i, router in self.routers.items():
+ num = SdnAutonomousSystem.routerIdx
+ SdnAutonomousSystem.routerIdx += 1
+ name = 'bgp%s' % num
+
+ cpIpBase = self.num*10
+ ip = AutonomousSystem.getIthAddress(self.internalPeeringSubnet, cpIpBase+i)
+
+ eth0 = { 'ipAddrs' : [ str(ip) ] }
+ if self.peerIntfConfig is not None:
+ eth1 = self.peerIntfConfig
+ else:
+ nativeAddresses = router.interfaces[1].addressesByVlan.pop(None, [])
+ eth1 = [{ 'mac': '00:00:00:00:00:%02x' % num,
+ 'ipAddrs' : nativeAddresses }]
+
+ for vlan, addresses in router.interfaces[1].addressesByVlan.items():
+ eth1.append({'vlan': vlan,
+ 'mac': '00:00:00:%02x:%02x:00' % (num, vlan),
+ 'ipAddrs': addresses})
+
+ intfs = { '%s-eth0' % name : eth0,
+ '%s-eth1' % name : eth1 }
+
+ bgp = topology.addHost( name, cls=BgpRouter, asNum=self.asNum,
+ neighbors=router.neighbors,
+ interfaces=intfs,
+ defaultRoute=str(natIp.ip),
+ fpm=self.onosIps[0] if self.withFpm else None )
+
+ topology.addLink( bgp, controlSwitch )
+ topology.addLink( bgp, connectAtSwitch )
+
+ if self.externalOnos:
+ nat = topology.addHost('nat', cls=NAT,
+ ip='%s/%s' % (natIp.ip, self.internalPeeringSubnet.prefixlen),
+ subnet=str(self.internalPeeringSubnet), inNamespace=False)
+ topology.addLink(controlSwitch, nat)
+
+def generateRoutes(baseRange, numRoutes, subnetSize=None):
+ baseNetwork = ip_network(baseRange)
+
+ # We need to get at least 2 addresses out of each subnet, so the biggest
+ # prefix length we can have is /30
+ maxPrefixLength = baseNetwork.max_prefixlen - 2
+
+ if subnetSize is not None:
+ return list(baseNetwork.subnets(new_prefix=subnetSize))
+
+ trySubnetSize = baseNetwork.prefixlen + 1
+ while trySubnetSize <= maxPrefixLength and \
+ len(list(baseNetwork.subnets(new_prefix=trySubnetSize))) < numRoutes:
+ trySubnetSize += 1
+
+ if trySubnetSize > maxPrefixLength:
+ raise Exception("Can't get enough routes from input parameters")
+
+ return list(baseNetwork.subnets(new_prefix=trySubnetSize))[:numRoutes]
+
+class RoutingCli( CLI ):
+
+ """CLI command that can bring a host up or down. Useful for simulating router failure."""
+
+ def do_host( self, line ):
+ args = line.split()
+ if len(args) != 2:
+ error( 'invalid number of args: host <host name> {up, down}\n' )
+ return
+
+ host = args[ 0 ]
+ command = args[ 1 ]
+ if host not in self.mn or self.mn.get( host ) not in self.mn.hosts:
+ error( 'invalid host: %s\n' % args[ 1 ] )
+ else:
+ if command == 'up':
+ op = 'up'
+ elif command == 'down':
+ op = 'down'
+ else:
+ error( 'invalid command: host <host name> {up, down}\n' )
+ return
+
+ for intf in self.mn.get( host ).intfList( ):
+ intf.link.intf1.ifconfig( op )
+ intf.link.intf2.ifconfig( op )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
new file mode 100644
index 0000000..a39ed13
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
@@ -0,0 +1,350 @@
+#!/usr/bin/python
+import os
+import re
+from optparse import OptionParser
+
+from ipaddress import ip_network
+from mininet.node import RemoteController, OVSBridge, Host
+from mininet.link import TCLink
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.nodelib import NAT
+from mininet.cli import CLI
+
+from routinglib import BgpRouter, RoutedHost
+from trellislib import DhcpServer, TaggedRoutedHost, DualHomedRoutedHost, DualHomedTaggedRoutedHost
+
+# Parse command line options and dump results
+def parseOptions():
+ "Parse command line options"
+ parser = OptionParser()
+ parser.add_option( '--spine', dest='spine', type='int', default=2,
+ help='number of spine switches, default=2' )
+ parser.add_option( '--leaf', dest='leaf', type='int', default=2,
+ help='number of leaf switches, default=2' )
+ parser.add_option( '--fanout', dest='fanout', type='int', default=2,
+ help='number of hosts per leaf switch, default=2' )
+ parser.add_option( '--onos-ip', dest='onosIp', type='str', default='',
+ help='IP address list of ONOS instances, separated by comma(,). Overrides --onos option' )
+ parser.add_option( '--ipv6', action="store_true", dest='ipv6',
+ help='hosts are capable to use also ipv6' )
+ parser.add_option( '--dual-homed', action="store_true", dest='dualhomed', default=False,
+ help='True if the topology is dual-homed, default=False' )
+ parser.add_option( '--vlan', dest='vlan', type='str', default='',
+ help='list of vlan id for hosts, separated by comma(,).'
+ 'Empty or id with 0 will be unconfigured.' )
+ ( options, args ) = parser.parse_args()
+ return options, args
+
+
+opts, args = parseOptions()
+
+IP6_SUBNET_CLASS = 120
+IP4_SUBNET_CLASS = 24
+
+# TODO: DHCP support
+class IpHost( Host ):
+
+ def __init__( self, name, *args, **kwargs ):
+ super( IpHost, self ).__init__( name, *args, **kwargs )
+ gateway = re.split( '\.|/', kwargs[ 'ip' ] )
+ gateway[ 3 ] = '254'
+ self.gateway = '.'.join( gateway[ 0:4 ] )
+
+ def config( self, **kwargs ):
+ Host.config( self, **kwargs )
+ mtu = "ifconfig " + self.name + "-eth0 mtu 1490"
+ self.cmd( mtu )
+ self.cmd( 'ip route add default via %s' % self.gateway )
+
+class DualHomedIpHost(IpHost):
+ def __init__(self, name, *args, **kwargs):
+ super(DualHomedIpHost, self).__init__(name, **kwargs)
+ self.bond0 = None
+
+ def config(self, **kwargs):
+ super(DualHomedIpHost, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+ self.bond0 = "%s-bond0" % self.name
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(DualHomedIpHost, self).terminate()
+
+
+# TODO: Implement IPv6 support
+class DualHomedLeafSpineFabric (Topo) :
+ def __init__(self, spine = 2, leaf = 4, fanout = 2, vlan_id = [], **opts):
+ Topo.__init__(self, **opts)
+ spines = dict()
+ leafs = dict()
+
+ # leaf should be 2 or 4
+
+ # calculate the subnets to use and set options
+ linkopts = dict( bw=100 )
+ # Create spine switches
+ for s in range(spine):
+ spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+ # Create leaf switches
+ for ls in range(leaf):
+ leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+ # Connect leaf to all spines with dual link
+ for s in range( spine ):
+ switch = spines[ s ]
+ self.addLink(leafs[ls], switch, **linkopts)
+ self.addLink(leafs[ls], switch, **linkopts)
+
+ # Add hosts after paired ToR switches are added.
+ if ls % 2 == 0:
+ continue
+
+ # Add leaf-leaf link
+ self.addLink(leafs[ls], leafs[ls-1])
+
+ dual_ls = ls / 2
+ # Add hosts
+ for f in range(fanout):
+ if vlan_id[ dual_ls * fanout + f] != 0:
+ host = self.addHost(
+ name='h%s' % ( dual_ls * fanout + f + 1),
+ cls=DualHomedTaggedRoutedHost,
+ ips=['10.0.%d.%d/%d' % ( dual_ls + 2, f + 1, IP4_SUBNET_CLASS)],
+ gateway='10.0.%d.254' % ( dual_ls + 2),
+ mac='00:aa:00:00:00:%02x' % (dual_ls * fanout + f + 1),
+ vlan=vlan_id[ dual_ls*fanout + f ]
+ )
+ else:
+ host = self.addHost(
+ name='h%s' % (dual_ls * fanout + f + 1),
+ cls= DualHomedRoutedHost,
+ ips=['10.0.%d.%d/%d' % (dual_ls+2, f+1, IP4_SUBNET_CLASS)],
+ gateway='10.0.%d.254' % (dual_ls+2),
+ mac='00:aa:00:00:00:%02x' % (dual_ls * fanout + f + 1)
+ )
+ self.addLink(host, leafs[ls], **linkopts)
+ self.addLink(host, leafs[ls-1], **linkopts)
+
+ last_ls = leafs[leaf-2]
+ last_paired_ls = leafs[leaf-1]
+ # Create common components
+ # DHCP server
+ dhcp = self.addHost('dhcp', cls=DhcpServer, mac='00:99:00:00:00:01', ips=['10.0.3.253/24'],
+ gateway='10.0.3.254')
+
+ # Control plane switch (for DHCP servers)
+ cs1 = self.addSwitch('cs1', cls=OVSBridge)
+ self.addLink(cs1, last_ls)
+ self.addLink(dhcp, cs1)
+
+ # Control plane switch (for quagga fpm)
+ cs0 = self.addSwitch('cs0', cls=OVSBridge)
+
+ # Control plane NAT (for quagga fpm)
+ nat = self.addHost('nat', cls=NAT,
+ ip='172.16.0.1/12',
+ subnet=str(ip_network(u'172.16.0.0/12')), inNamespace=False)
+ self.addLink(cs0, nat)
+
+ # Internal Quagga bgp1
+ intfs = {'bgp1-eth0': {'ipAddrs': ['10.0.1.2/24', '2000::102/120'], 'mac': '00:88:00:00:00:02'},
+ 'bgp1-eth1': {'ipAddrs': ['172.16.0.2/12']}}
+ bgp1 = self.addHost('bgp1', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdbgp1.conf',
+ zebraConfFile='conf/zebradbgp1.conf')
+ self.addLink(bgp1, last_ls)
+ self.addLink(bgp1, cs0)
+
+ # Internal Quagga bgp2
+ intfs = {'bgp2-eth0': [{'ipAddrs': ['10.0.5.2/24', '2000::502/120'], 'mac': '00:88:00:00:00:04', 'vlan': '150'},
+ {'ipAddrs': ['10.0.6.2/24', '2000::602/120'], 'mac': '00:88:00:00:00:04', 'vlan': '160'}],
+ 'bgp2-eth1': {'ipAddrs': ['172.16.0.4/12']}}
+ bgp2 = self.addHost('bgp2', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdbgp2.conf',
+ zebraConfFile='conf/zebradbgp2.conf')
+ self.addLink(bgp2, last_paired_ls)
+ self.addLink(bgp2, cs0)
+
+ # External Quagga r1
+ intfs = {'r1-eth0': {'ipAddrs': ['10.0.1.1/24', '2000::101/120'], 'mac': '00:88:00:00:00:01'},
+ 'r1-eth1': {'ipAddrs': ['10.0.5.1/24', '2000::501/120'], 'mac': '00:88:00:00:00:11'},
+ 'r1-eth2': {'ipAddrs': ['10.0.99.1/16']}}
+ r1 = self.addHost('r1', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdr1.conf')
+ self.addLink(r1, last_ls)
+ self.addLink(r1, last_paired_ls)
+
+ # External IPv4 Host behind r1
+ rh1 = self.addHost('rh1', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+ self.addLink(r1, rh1)
+
+ # External Quagga r2
+ intfs = {'r2-eth0': {'ipAddrs': ['10.0.6.1/24', '2000::601/120'], 'mac': '00:88:00:00:00:02'},
+ 'r2-eth1': {'ipAddrs': ['10.0.7.1/24', '2000::701/120'], 'mac': '00:88:00:00:00:22'},
+ 'r2-eth2': {'ipAddrs': ['10.0.99.1/16']}}
+ r2 = self.addHost('r2', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdr2.conf')
+ self.addLink(r2, last_ls)
+ self.addLink(r2, last_paired_ls)
+
+ # External IPv4 Host behind r2
+ rh2 = self.addHost('rh2', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+ self.addLink(r2, rh2)
+
+class LeafSpineFabric (Topo) :
+ def __init__(self, spine = 2, leaf = 2, fanout = 2, vlan_id = [], **opts):
+ Topo.__init__(self, **opts)
+ spines = dict()
+ leafs = dict()
+
+ # TODO: support IPv6 hosts
+ linkopts = dict( bw=100 )
+
+ # Create spine switches
+ for s in range(spine):
+ spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+ # Create leaf switches
+ for ls in range(leaf):
+ leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+ # Connect leaf to all spines
+ for s in range( spine ):
+ switch = spines[ s ]
+ self.addLink( leafs[ ls ], switch, **linkopts )
+
+ # If dual-homed ToR, add hosts only when adding second switch at each edge-pair
+ # When the number of leaf switches is odd, leave the last switch as a single ToR
+
+ # Add hosts
+ for f in range(fanout):
+ if vlan_id[ls * fanout + f] != 0:
+ host = self.addHost(
+ name='h%s' % (ls * fanout + f + 1),
+ cls=TaggedRoutedHost,
+ ips=['10.0.%d.%d/%d' % (ls+2, f+1, IP4_SUBNET_CLASS)],
+ gateway='10.0.%d.254' % (ls+2),
+ mac='00:aa:00:00:00:%02x' % (ls * fanout + f + 1),
+ vlan=vlan_id[ ls*fanout + f ]
+ )
+ else:
+ host = self.addHost(
+ name='h%s' % (ls * fanout + f + 1),
+ cls= RoutedHost,
+ ips=['10.0.%d.%d/%d' % (ls+2, f+1, IP4_SUBNET_CLASS)],
+ gateway='10.0.%d.254' % (ls+2),
+ mac='00:aa:00:00:00:%02x' % (ls * fanout + f + 1)
+ )
+ self.addLink(host, leafs[ls], **linkopts)
+
+ last_ls = leafs[leaf-1]
+ # Create common components
+ # DHCP server
+ dhcp = self.addHost('dhcp', cls=DhcpServer, mac='00:99:00:00:00:01', ips=['10.0.3.253/24'],
+ gateway='10.0.3.254')
+
+ # Control plane switch (for DHCP servers)
+ cs1 = self.addSwitch('cs1', cls=OVSBridge)
+ self.addLink(cs1, last_ls)
+ self.addLink(dhcp, cs1)
+
+ # Control plane switch (for quagga fpm)
+ cs0 = self.addSwitch('cs0', cls=OVSBridge)
+
+ # Control plane NAT (for quagga fpm)
+ nat = self.addHost('nat', cls=NAT,
+ ip='172.16.0.1/12',
+ subnet=str(ip_network(u'172.16.0.0/12')), inNamespace=False)
+ self.addLink(cs0, nat)
+
+ # Internal Quagga bgp1
+ intfs = {'bgp1-eth0': {'ipAddrs': ['10.0.1.2/24', '2000::102/120'], 'mac': '00:88:00:00:00:02'},
+ 'bgp1-eth1': {'ipAddrs': ['172.16.0.2/12']}}
+ bgp1 = self.addHost('bgp1', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdbgp1.conf',
+ zebraConfFile='conf/zebradbgp1.conf')
+ self.addLink(bgp1, last_ls)
+ self.addLink(bgp1, cs0)
+
+ # External Quagga r1
+ intfs = {'r1-eth0': {'ipAddrs': ['10.0.1.1/24', '2000::101/120'], 'mac': '00:88:00:00:00:01'},
+ 'r1-eth1': {'ipAddrs': ['10.0.99.1/16']},
+ 'r1-eth2': {'ipAddrs': ['2000::9901/120']}}
+ r1 = self.addHost('r1', cls=BgpRouter,
+ interfaces=intfs,
+ quaggaConfFile='conf/bgpdr1.conf')
+ self.addLink(r1, last_ls)
+
+ # External IPv4 Host behind r1
+ rh1 = self.addHost('rh1', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
+ self.addLink(r1, rh1)
+
+def config( opts ):
+ spine = opts.spine
+ leaf = opts.leaf
+ fanout = opts.fanout
+ ipv6 = opts.ipv6
+ dualhomed = opts.dualhomed
+ if opts.vlan == '':
+ vlan = [0] * (((leaf / 2) if dualhomed else leaf) * fanout)
+ else:
+ vlan = [int(vlan_id) if vlan_id != '' else 0 for vlan_id in opts.vlan.split(',')]
+
+ if opts.onosIp != '':
+ controllers = opts.onosIp.split( ',' )
+ else:
+ controllers = ['127.0.0.1']
+
+ if len(vlan) != ((leaf / 2) if dualhomed else leaf ) * fanout:
+ print "Invalid vlan configuration is given."
+ return
+
+ if not ipv6:
+ if dualhomed:
+ if leaf % 2 == 1 or leaf == 0:
+ print "Even number of leaf switches (at least two) are needed to build dual-homed topology."
+ return
+ else:
+ topo = DualHomedLeafSpineFabric(spine=spine, leaf=leaf, fanout=fanout, vlan_id=vlan)
+ else:
+ topo = LeafSpineFabric(spine=spine, leaf=leaf, fanout=fanout, vlan_id=vlan)
+ else:
+ print "IPv6 hosts are not supported yet."
+ return
+
+ net = Mininet( topo=topo, link=TCLink, build=False,
+ controller=None, autoSetMacs=True )
+ i = 0
+ for ip in controllers:
+ net.addController( "c%s" % ( i ), controller=RemoteController, ip=ip )
+ i += 1
+ net.build()
+ net.start()
+ CLI( net )
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ config(opts)
+ os.system('sudo mn -c')
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
new file mode 100644
index 0000000..08dcf2f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+
+"""
+Libraries for Trellis hosts.
+"""
+
+import sys
+sys.path.append('..')
+from mininet.node import Host
+from routinglib import RoutedHost, RoutedHost6, Router
+
+class TaggedRoutedHost(RoutedHost):
+ """Host that can be configured with multiple IP addresses."""
+ def __init__(self, name, ips, gateway, vlan, *args, **kwargs):
+ super(RoutedHost, self).__init__(name, *args, **kwargs)
+ self.ips = ips
+ self.gateway = gateway
+ self.vlan = vlan
+ self.vlanIntf = None
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+ intf = self.defaultIntf()
+ self.vlanIntf = "%s.%s" % (intf, self.vlan)
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd('ip link add link %s name %s type vlan id %s' % (intf, self.vlanIntf, self.vlan))
+ self.cmd('ip link set up %s' % self.vlanIntf)
+
+ for ip in self.ips:
+ self.cmd('ip addr add %s dev %s' % (ip, self.vlanIntf))
+
+ self.cmd('ip route add default via %s' % self.gateway)
+ intf.name = self.vlanIntf
+ self.nameToIntf[self.vlanIntf] = intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link remove link %s' % self.vlanIntf)
+ super(TaggedRoutedHost, self).terminate()
+
+class DualHomedRoutedHost(Host):
+ def __init__(self, name, ips, gateway, *args, **kwargs):
+ super(DualHomedRoutedHost, self).__init__(name, **kwargs)
+ self.bond0 = None
+ self.ips = ips
+ self.gateway = gateway
+
+ def config(self, **kwargs):
+ super(DualHomedRoutedHost, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+ self.bond0 = "%s-bond0" % self.name
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+
+ for ip in self.ips:
+ self.cmd('ip addr add %s dev %s' % (ip, self.bond0))
+
+ self.cmd('ip route add default via %s' % self.gateway)
+ default_intf = self.defaultIntf()
+ default_intf.name = self.bond0
+ self.nameToIntf[self.bond0] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ super(DualHomedRoutedHost, self).terminate()
+
+class DualHomedTaggedRoutedHost(DualHomedRoutedHost):
+ def __init__(self, name, ips, gateway, vlan, *args, **kwargs):
+ super(DualHomedTaggedRoutedHost, self).__init__(name, ips, gateway, *args, **kwargs)
+ self.ips = ips
+ self.gateway = gateway
+ self.vlan = vlan
+ self.vlanIntf = None
+
+ def config(self, **kwargs):
+ super(DualHomedTaggedRoutedHost, self).config(**kwargs)
+ default_intf = self.defaultIntf()
+ self.vlanIntf = "%s.%s" % (default_intf, self.vlan)
+ self.cmd('ip -4 addr flush dev %s' % default_intf)
+ self.cmd('ip link add link %s name %s type vlan id %s' % (default_intf, self.vlanIntf, self.vlan))
+ self.cmd('ip link set up %s' % self.vlanIntf)
+
+ for ip in self.ips:
+ self.cmd('ip addr add %s dev %s' % (ip, self.vlanIntf))
+
+ self.cmd('ip route add default via %s' % self.gateway)
+ default_intf.name = self.vlanIntf
+ self.nameToIntf[self.vlanIntf] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link remove link %s' % self.vlanIntf)
+ super(DualHomedTaggedRoutedHost, self).terminate()
+
+class DhcpClient(Host):
+ def __init__(self, name, *args, **kwargs):
+ super(DhcpClient, self).__init__(name, **kwargs)
+ self.pidFile = '/run/dhclient-%s.pid' % self.name
+ self.leaseFile = '/var/lib/dhcp/dhcpclient-%s.lease' % (self.name, )
+
+ def config(self, **kwargs):
+ super(DhcpClient, self).config(**kwargs)
+ self.cmd('ip addr flush dev %s' % self.defaultIntf())
+ self.cmd('dhclient -q -4 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(DhcpClient, self).terminate()
+
+class Dhcp6Client(Host):
+ def __init__(self, name, *args, **kwargs):
+ super(Dhcp6Client, self).__init__(name, **kwargs)
+ self.pidFile = '/run/dhclient-%s.pid' % self.name
+ self.leaseFile = '/var/lib/dhcp/dhcpclient6-%s.lease' % (self.name, )
+
+ def config(self, **kwargs):
+ super(Dhcp6Client, self).config(**kwargs)
+ self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+ self.cmd('dhclient -q -6 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(Dhcp6Client, self).terminate()
+
+class DhcpServer(RoutedHost):
+ binFile = '/usr/sbin/dhcpd'
+ pidFile = '/run/dhcp-server-dhcpd.pid'
+ configFile = './dhcpd.conf'
+ leasesFile = '/var/lib/dhcp/dhcpd.leases'
+
+ def config(self, **kwargs):
+ super(DhcpServer, self).config(**kwargs)
+ self.cmd('touch %s' % self.leasesFile)
+ self.cmd('%s -q -4 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.defaultIntf()))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(DhcpServer, self).terminate()
+
+class Dhcp6Server(RoutedHost6):
+ binFile = '/usr/sbin/dhcpd'
+ pidFile = '/run/dhcp-server-dhcpd6.pid'
+ configFile = './dhcpd6.conf'
+ leasesFile = '/var/lib/dhcp/dhcpd6.leases'
+
+ def config(self, **kwargs):
+ super(Dhcp6Server, self).config(**kwargs)
+ linkLocalAddr = mac_to_ipv6_linklocal(kwargs['mac'])
+ self.cmd('ip -6 addr add dev %s scope link %s' % (self.defaultIntf(), linkLocalAddr))
+ self.cmd('touch %s' % self.leasesFile)
+ self.cmd('%s -q -6 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.defaultIntf()))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ self.cmd('rm -rf %s' % self.leasesFile)
+ super(Dhcp6Server, self).terminate()
+
+class DhcpRelay(Router):
+ binFile = '/usr/sbin/dhcrelay'
+ pidFile = '/run/dhcp-relay.pid'
+ serverIp = None
+ gateway = None
+
+ def __init__(self, name, serverIp, gateway, *args, **kwargs):
+ super(DhcpRelay, self).__init__(name, **kwargs)
+ self.serverIp = serverIp
+ self.gateway = gateway
+
+ def config(self, **kwargs):
+ super(DhcpRelay, self).config(**kwargs)
+ ifacesStr = ' '.join(["-i " + ifaceName for ifaceName in self.interfaces.keys()])
+ self.cmd('route add default gw %s' % self.gateway)
+ self.cmd('%s -4 -a -pf %s %s %s' % (self.binFile, self.pidFile, ifacesStr, self.serverIp))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`', self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(DhcpRelay, self).terminate()
+
+class TaggedDhcpClient(Host):
+ def __init__(self, name, vlan, *args, **kwargs):
+ super(TaggedDhcpClient, self).__init__(name, **kwargs)
+ self.pidFile = '/run/dhclient-%s.pid' % self.name
+ self.vlan = vlan
+ self.vlanIntf = None
+
+ def config(self, **kwargs):
+ super(TaggedDhcpClient, self).config(**kwargs)
+ self.vlanIntf = "%s.%s" % (self.defaultIntf(), self.vlan)
+ self.cmd('ip addr flush dev %s' % self.defaultIntf())
+ self.cmd('ip link add link %s name %s type vlan id %s' % (self.defaultIntf(), self.vlanIntf, self.vlan))
+ self.cmd('ip link set up %s' % self.vlanIntf)
+ self.cmd('dhclient -q -4 -nw -pf %s %s' % (self.pidFile, self.vlanIntf))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ self.cmd('ip link remove link %s' % self.vlanIntf)
+ super(TaggedDhcpClient, self).terminate()
+
+class TaggedDhcpServer(TaggedRoutedHost):
+ binFile = '/usr/sbin/dhcpd'
+ pidFile = '/run/dhcp-server/dhcpd.pid'
+ configFile = './dhcpd.conf'
+
+ def config(self, **kwargs):
+ super(TaggedDhcpServer, self).config(**kwargs)
+ self.cmd('%s -q -4 -pf %s -cf %s %s' % (self.binFile, self.pidFile, self.configFile, self.vlanIntf))
+
+ def terminate(self, **kwargs):
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(TaggedDhcpServer, self).terminate()
+
+class DualHomedDhcpClient(Host):
+ def __init__(self, name, *args, **kwargs):
+ super(DualHomedDhcpClient, self).__init__(name, **kwargs)
+ self.pidFile = '/run/dhclient-%s.pid' % self.name
+ self.bond0 = None
+
+ def config(self, **kwargs):
+ super(DualHomedDhcpClient, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+ self.bond0 = "%s-bond0" % self.name
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+ self.cmd('dhclient -q -4 -nw -pf %s %s' % (self.pidFile, self.bond0))
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ self.cmd('kill -9 `cat %s`' % self.pidFile)
+ self.cmd('rm -rf %s' % self.pidFile)
+ super(DualHomedDhcpClient, self).terminate()
+
+# Utility for IPv6
+def mac_to_ipv6_linklocal(mac):
+ '''
+ Convert mac address to link-local IPv6 address
+ '''
+ # Remove the most common delimiters; dots, dashes, etc.
+ mac_value = int(mac.translate(None, ' .:-'), 16)
+
+ # Split out the bytes that slot into the IPv6 address
+ # XOR the most significant byte with 0x02, inverting the
+ # Universal / Local bit
+ high2 = mac_value >> 32 & 0xffff ^ 0x0200
+ high1 = mac_value >> 24 & 0xff
+ low1 = mac_value >> 16 & 0xff
+ low2 = mac_value & 0xffff
+
+ return 'fe80::{:04x}:{:02x}ff:fe{:02x}:{:04x}'.format(high2, high1, low1, low2)
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
index 23607ad..14a7c69 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/USECASE_SdnipI2MN.py
@@ -39,7 +39,6 @@
QUAGGA_DIR = '/usr/lib/quagga'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/'
-# onos1IP = '10.254.1.201'
numSw = 39
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/sdnip_single_instance b/TestON/tests/USECASE/USECASE_SdnipFunction/sdnip_single_instance
index c2c51c6..9e0be8e 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/sdnip_single_instance
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/sdnip_single_instance
@@ -1,8 +1,8 @@
export ONOS_CELL="sdnip_single_instance"
export ONOS_INSTALL_DIR="/opt/onos"
-export ONOS_NIC=10.254.1.*
-export OC1="10.254.1.201"
+export ONOS_NIC=10.192.19.*
+export OC1="10.192.19.68"
export OCN="127.0.0.1"
export OCI="${OC1}"
export ONOS_USER="sdn" # ONOS user on remote system
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM
index 1053083..dc9cfea 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/sdnip_multiple_instance_BM
@@ -1,10 +1,10 @@
export ONOS_CELL="sdnip_multiple_instance_BM"
export ONOS_INSTALL_DIR="/opt/onos"
-export ONOS_NIC=10.254.1.*
-export OC1="10.254.1.201"
-export OC2="10.254.1.202"
-export OC3="10.254.1.203"
+export ONOS_NIC=10.192.19.*
+export OC1="10.192.19.68"
+export OC2="10.192.19.67"
+export OC3="10.192.19.66"
export OCN="127.0.0.1"
export OCI="${OC1}"
export ONOS_USER="sdn" # ONOS user on remote system
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
index 4f8d159..8a44063 100644
--- a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
@@ -70,7 +70,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
+ main.testSetUp.ONOSSetUp( main.Cluster,
cellName=main.cellName )
main.step( "Starting Mininet" )
diff --git a/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py b/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py
index 9778b68..c8dd52b 100644
--- a/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py
+++ b/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py
@@ -77,7 +77,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
- main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
+ main.testSetUp.ONOSSetUp( main.Cluster,
cellName=cellName )
main.step( "Starting Mininet" )
diff --git a/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py b/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
index c5eb905..796d5bd 100644
--- a/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
+++ b/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
@@ -27,9 +27,7 @@
actual=status,
onpass="Copy config file succeeded",
onfail="Copy config file failed" )
- main.testSetUp.ONOSSetUp( main.Mininet,
- main.Cluster,
- cellName=cellName )
+ main.testSetUp.ONOSSetUp( main.Cluster, cellName=cellName )
main.step( "Checking if ONOS CLI is ready for issuing commands" )
ready = utilities.retry( main.Cluster.command,
diff --git a/TestON/tests/dependencies/Cluster.py b/TestON/tests/dependencies/Cluster.py
index b0af55e..26981b9 100644
--- a/TestON/tests/dependencies/Cluster.py
+++ b/TestON/tests/dependencies/Cluster.py
@@ -149,23 +149,27 @@
"""
self.iterator = iter( self.active() )
- def createCell( self, cellName, Mininet, useSSH, ips, installMax=False ):
+ def createCell( self, cellName, cellApps, mininetIp, useSSH, ips, installMax=False ):
"""
Description:
create a new cell
Required:
* cellName - The name of the cell.
- * Mininet - a mininet driver that will be used.
+ * cellApps - The ONOS apps string.
+ * mininetIp - Mininet IP address.
* useSSH - True for using ssh when creating a cell
* ips - ip( s ) of the node( s ).
Returns:
"""
+ try:
+ apps = main.apps
+ except ( NameError, AttributeError ):
+ apps = cellApps
self.command( "createCellFile",
args=[ main.ONOSbench.ip_address,
cellName,
- Mininet if isinstance( Mininet, str ) else
- Mininet.ip_address,
- main.apps,
+ mininetIp,
+ apps,
ips,
main.ONOScell.karafUser,
useSSH ],
@@ -235,15 +239,10 @@
ctrl = self.controllers[ i ]
onosIsUp = onosIsUp and onosUp[ i ]
if onosUp[ i ] == main.TRUE:
- main.log.report( ctrl.name + " is up and ready" )
+ main.log.info( ctrl.name + " is up and ready" )
else:
- main.log.report( ctrl.name + " may not be up, stop and " +
- "start ONOS again " )
- stopResult = stopResult and main.ONOSbench.onosStop( ctrl.ipAddress )
- startResult = startResult and main.ONOSbench.onosStart( ctrl.ipAddress )
- if not startResult or stopResult:
- main.log.report( ctrl.name + " did not start correctly." )
- return onosIsUp and stopResult and startResult
+ main.log.warn( ctrl.name + " may not be up." )
+ return onosIsUp
def kill( self, killMax, stopOnos ):
"""
@@ -315,6 +314,7 @@
else:
result = result and \
main.ONOSbench.onosInstall( node=ctrl.ipAddress, options=options )
+ i += 1
if installParallel:
for t in threads:
t.join()
@@ -494,6 +494,7 @@
maxSize = float( segmentSize ) * float( multiplier )
ret = True
for n in self.runningNodes:
- ret = ret and n.server.folderSize( "/opt/onos/apache-karaf-*/data/partitions/*/*.log",
+ # Partition logs
+ ret = ret and n.server.folderSize( "/opt/onos/apache-karaf-*/data/db/partitions/*/*.log",
size=maxSize, unit=units, ignoreRoot=False )
return ret
diff --git a/TestON/tests/dependencies/Network.py b/TestON/tests/dependencies/Network.py
new file mode 100644
index 0000000..6377c0c
--- /dev/null
+++ b/TestON/tests/dependencies/Network.py
@@ -0,0 +1,58 @@
+"""
+Copyright 2018 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ ( at your option ) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+import json
+class Network():
+
+ def __str__( self ):
+ return self.name
+
+ def __repr__( self ):
+ return "%s:%s" % ( self.name, self.components )
+
+ def __getattr__( self, name ):
+ """
+ Called when an attribute lookup has not found the attribute
+ in the usual places (i.e. it is not an instance attribute nor
+ is it found in the class tree for self). name is the attribute
+ name. This method should return the (computed) attribute value
+ or raise an AttributeError exception.
+
+ We will look into each of the network component handles to try
+ to find the attreibute.
+ """
+ #FIXME: allow to call a specific driver
+ for component in self.components:
+ if hasattr( component, name ):
+ main.log.debug( "%s has attribute '%s'" % ( component.options[ 'name' ], name ) )
+ return getattr( component, name )
+ raise AttributeError( "Could not find attribute '%s' in any of these components: %s" % ( name, self.components ) )
+
+ def __init__( self, name="Network" ):
+ """
+ components: network components created for the test
+ """
+ self.name = str( name )
+ # Get a list of network components that are created in the test
+ self.components = []
+ for key, value in main.componentDictionary.items():
+ if value[ 'type' ] in [ 'MininetCliDriver', 'RemoteMininetDriver', 'NetworkDriver' ] and hasattr( main, key ):
+ self.components.append( getattr( main, key ) )
+ main.log.debug( "%s initialized with components: %s" % ( self.name, self.components ) )
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index ed4d978..cbf7f8c 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -197,8 +197,8 @@
return cluster.kill( killRemoveMax, stopOnos )
- def createApplyCell( self, cluster, newCell, cellName,
- Mininet, useSSH, ips, installMax=False ):
+ def createApplyCell( self, cluster, newCell, cellName, cellApps,
+ mininetIp, useSSH, ips, installMax=False ):
"""
Description:
create new cell ( optional ) and apply it. It will also verify the
@@ -207,14 +207,15 @@
* cluster - the cluster driver that will be used.
* newCell - True for making a new cell and False for not making it.
* cellName - The name of the cell.
- * Mininet - a mininet driver that will be used.
+ * cellApps - The onos apps string.
+ * mininetIp - Mininet IP address.
* useSSH - True for using ssh when creating a cell
* ips - ip( s ) of the node( s ).
Returns:
Returns main.TRUE if it successfully executed.
"""
if newCell:
- cluster.createCell( cellName, Mininet, useSSH, ips )
+ cluster.createCell( cellName, cellApps, mininetIp, useSSH, ips )
main.step( "Apply cell to environment" )
stepResult = cluster.applyCell( cellName )
utilities.assert_equals( expect=main.TRUE,
@@ -351,10 +352,10 @@
else:
functions( *args ) if args is not None else functions()
- def ONOSSetUp( self, Mininet, cluster, hasMultiNodeRounds=False, startOnos=True, newCell=True,
- cellName="temp", removeLog=False, extraApply=None, applyArgs=None, extraClean=None,
- cleanArgs=None, skipPack=False, installMax=False, useSSH=True, killRemoveMax=True,
- stopOnos=False, installParallel=True ):
+ def ONOSSetUp( self, cluster, hasMultiNodeRounds=False, startOnos=True, newCell=True,
+ cellName="temp", cellApps="drivers", mininetIp="", removeLog=False, extraApply=None, applyArgs=None,
+ extraClean=None, cleanArgs=None, skipPack=False, installMax=False, useSSH=True,
+ killRemoveMax=True, stopOnos=False, installParallel=True, cellApply=True ):
"""
Description:
Initial ONOS setting up of the tests. It will also verify the result of each steps.
@@ -371,12 +372,13 @@
checking the onos service
starting onos
Required:
- * Mininet - the mininet driver that will be used
* cluster - the cluster driver that will be used.
* hasMultiNodeRouds - True if the test is testing different set of nodes
* startOnos - True if wish to start onos.
* newCell - True for making a new cell and False for not making it.
* cellName - Name of the cell that will be used.
+ * cellApps - The cell apps string.
+ * mininetIp - Mininet IP address.
* removeLog - True if wish to remove raft logs
* extraApply - Function( s ) that will be called before building ONOS. Default to None.
* applyArgs - argument of the functon( s ) of the extraApply. Should be in list.
@@ -403,23 +405,30 @@
main.log.info( "NODE COUNT = " + str( cluster.numCtrls ) )
cellResult = main.TRUE
packageResult = main.TRUE
- onosUninstallResult = main.TRUE
onosCliResult = main.TRUE
- if not skipPack:
+ if cellApply:
tempOnosIp = []
for ctrl in cluster.runningNodes:
tempOnosIp.append( ctrl.ipAddress )
+ if mininetIp == "":
+ mininetIp = "localhost"
+ for key, value in main.componentDictionary.items():
+ if value['type'] in ['MininetCliDriver', 'RemoteMininetDriver'] and hasattr( main, key ):
+ mininetIp = getattr( main, key ).ip_address
+ break
cellResult = self.createApplyCell( cluster, newCell,
- cellName, Mininet,
- useSSH, tempOnosIp,
- installMax )
- if removeLog:
- main.log.info( "Removing raft logs" )
- main.ONOSbench.onosRemoveRaftLogs()
+ cellName, cellApps,
+ mininetIp, useSSH,
+ tempOnosIp, installMax )
- onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax )
- self.processList( extraApply, applyArgs )
- packageResult = self.buildOnos( cluster )
+ if removeLog:
+ main.log.info("Removing raft logs")
+ main.ONOSbench.onosRemoveRaftLogs()
+ onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax )
+ self.processList( extraApply, applyArgs )
+
+ if not skipPack:
+ packageResult = self.buildOnos(cluster)
onosInstallResult = self.installOnos( cluster, installMax, installParallel )
diff --git a/TestON/tests/dependencies/utils.py b/TestON/tests/dependencies/utils.py
index e1c2027..6155201 100644
--- a/TestON/tests/dependencies/utils.py
+++ b/TestON/tests/dependencies/utils.py
@@ -54,7 +54,7 @@
onfail="Failed to stopped mininet" )
return topoResult
- def copyKarafLog( self, copyFileName="" ):
+ def copyKarafLog( self, copyFileName="", before=False ):
"""
Description:
copy the karaf log and verify it.
@@ -78,7 +78,10 @@
"/tmp/karaf.log",
direction="from" )
copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
- copyFileName=( "karaf.log." + ctrl.name +
+ copyFileName= ( copyFileName + "_karaf.log." +
+ ctrl.name + "_" )
+ if before else
+ ( "karaf.log." + ctrl.name +
"." + copyFileName ) )
if scpResult and copyResult:
stepResult = main.TRUE and stepResult