Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action for retrieving Contrail port of vCenter virtual machine.
Change-Id: Ib7c25900050819f170cb34d9b2240982dc0d11e3 Depends-On: I8ea9a0a398fe9dc4357a8018456e61f7e79d7b41 Depends-On: I600cae79b9c2a388c4d666957aa8539338b49651 Partial-Bug: #1767046
- Loading branch information
1 parent
de88ec1
commit b5b0bf0
Showing
8 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#maven.buildNumber.plugin properties file | ||
#Thu Apr 26 13:03:36 CEST 2018 | ||
buildNumber=1309 | ||
#Fri Apr 27 08:34:41 CEST 2018 | ||
buildNumber=1313 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
o11nplugin-contrail-workflows/src/main/js/actions/portOfVCVirtualMachine.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var id = vcvm.instanceId; | ||
|
||
// default to 15 second timeout | ||
if(!timeout) timeout = 15; | ||
var start = new Date(); | ||
var timeoutDate = new Date(start.getTime() + (timeout * 1000)); | ||
|
||
var vm = null; | ||
var ports = null; | ||
|
||
while(true) { | ||
vm = connection.findVirtualMachine(id); | ||
if(vm) { | ||
ports = vm.portBackRefs; | ||
if(ports.length > 0) | ||
break; | ||
} | ||
if(new Date().getTime() > timeoutDate.getTime()) | ||
throw "Failed to retrieve port of virtual machine due to timeout."; | ||
System.sleep(500); | ||
} | ||
|
||
return ports[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...n-contrail-workflows/src/main/kotlin/net/juniper/contrail/vro/workflows/custom/VCenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.workflows.custom | ||
|
||
import net.juniper.contrail.api.types.VirtualMachineInterface | ||
import net.juniper.contrail.vro.config.constants.Connection | ||
import net.juniper.contrail.vro.config.constants.VC | ||
import net.juniper.contrail.vro.config.constants.VirtualMachine | ||
import net.juniper.contrail.vro.config.portOfVCVirtualMachine | ||
import net.juniper.contrail.vro.workflows.dsl.ofType | ||
import net.juniper.contrail.vro.workflows.model.Reference | ||
import net.juniper.contrail.vro.workflows.model.number | ||
import net.juniper.contrail.vro.workflows.model.reference | ||
|
||
val portOfVCVirtualMachineAction = ActionDefinition( | ||
name = portOfVCVirtualMachine, | ||
resultType = reference<VirtualMachineInterface>(), | ||
parameters = listOf("connection" ofType Reference(Connection), | ||
"vcvm" ofType Reference(VirtualMachine, VC), | ||
"timeout" ofType number) | ||
) |