-
-
-
-
Importing and synchronizing StyleBooks from GitHub repository
-
Simplified migration of Citrix ADC application configuration using StyleBooks
-
-
Expressions
-
Use ADM log messages for managing and monitoring your infrastructure
-
-
Citrix ADC automation using Citrix ADM in Cisco ACI hybrid mode
-
Citrix ADC device package in Cisco ACI's cloud orchestrator mode
-
This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已经过机器动态翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
이 콘텐츠는 동적으로 기계 번역되었습니다. 책임 부인
Este texto foi traduzido automaticamente. (Aviso legal)
Questo contenuto è stato tradotto dinamicamente con traduzione automatica.(Esclusione di responsabilità))
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.책임 부인
Este artigo foi traduzido automaticamente.(Aviso legal)
这篇文章已经过机器翻译.放弃
Questo articolo è stato tradotto automaticamente.(Esclusione di responsabilità))
Translation failed!
Expressions
One of the most powerful features of a StyleBook is the use of expressions. You can use StyleBooks expressions in various scenarios to compute dynamic values. The following example is an expression to concatenate a parameter value with a literal string.
Example:
$parameters.appname + "-mon"
<!--NeedCopy-->
This expression retrieves the parameter named appname
, and concatenates it with the string -mon
.
The following types of expressions are supported:
Arithmetic expressions
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulo (%)
Examples:
- Adding two numbers: $parameters.a + $parameters.b
- Multiplying two numbers: $parameters.a * 10
- Finding the remainder after division of one number by another:
15%10
Results in 5
String expressions
- Concatenate two strings (+)
Example:
Concatenate two strings: str(“app-“) + $parameters.appname
List expressions
Merges two lists (+)
Example:
-
Concatenate two lists: $parameters.external-servers + $parameters.internal-servers
-
If
$parameters.ports-1
is [80, 81] and$parameters.port-2
is [81, 82], the$parameters.ports-1 + $parameters.ports-2
displays as a list [80, 81, 81, 82].
Relational expressions
-
== : Tests if two operands are equal and returns true if they are equal, else returns false.
-
!= : Tests if two operands are different and returns true if they are different, else returns false.
-
> : Returns true if the first operand is greater than the second operand, else returns false.
-
>= : Returns true if the first operand is greater than or equal to the second operand, else returns false.
-
< : Returns true if the first operand is lesser than the second operand, else returns false.
-
<= : Returns true if the first operand is lesser than or equal to the second operand, else returns false.
Example:
- Use of Equality operator:
$parameters.name = = "abcd"
- Use of Inequality operator:
$parameters.name != "default"
- Examples for other relational operators
- 10 > 9
- 10 >= 10
- 0 < 9
- 10 <= 9
- 10 == 10
- 10 != 1
Logical expressions - boolean
-
and: The logical ‘and’ operator. If both operands are true, the result is true, else it is false.
-
or: The logical ‘or’ operator. If one of the operands is true, the result is true, else it is false.
-
not: The unary operator. If the operand is true, the result is false, and the opposite way.
-
in: Tests whether the first argument is a substring of the second argument
-
in: Tests if an item is part of a list
Note
You can type-cast expressions where strings are converted into numbers and numbers are converted to strings. Similarly, you can cast
tcp-port
to a number, and an IP address can be cast to a string.Use a delimiter before and after any operator. You can use the following delimiters:
Before an operator:
space
,tab
,comma
,(
,)
,[
,]
After an operator:
space
,tab
,(
,[
For example:
abc + def
100 % 10
10 > 9
Verbatim string expressions
You can use verbatim strings when special characters in a string have to take their literal form. These strings can contain escape characters, backslash, quotes, parentheses, whitespaces, brackets, and so on. In verbatim strings, the special characters’ usual interpretation is skipped. All the characters in the string are preserved in their literal form.
In StyleBooks, you can include Citrix ADC Policy Expressions in their literal form using verbatim strings. The Policy Expressions typically contain special characters. Without verbatim strings, you have to escape special characters by breaking strings into substrings.
To create a verbatim string, encapsulate a string between special characters as follows:
~{string}~
<!--NeedCopy-->
You can use verbatim strings anywhere in the StyleBook.
Note
Do not use the sequence of characters
}~
in an input string because this sequence indicates the end of a verbatim string.
Example:
~{HTTP.REQ.COOKIE.VALUE("jsessionid") ALT HTTP.REQ.URL.BEFORE_STR("=").AFTER_STR(";jsessionid=") ALT HTTP.REQ.URL.AFTER_STR(";jsessionid=")}~
<!--NeedCopy-->
Target expressions
In a StyleBook definition, you can use the $current-target
expression to refer to the current target ADC instance. To specifically refer to the IP address of the target ADC instance, use this expression as follows:
$current-target.ip
<!--NeedCopy-->
Example:
components:
-
name: lb-comp
type: ns::lbvserver
properties:
name: $current-target.ip + "-lbvserver"
<!--NeedCopy-->
In this example, the name of the lbvserver
is constructed with the IP address of the target ADC instance.
Expression Type Validation
StyleBook engine allows for stronger type checking during compile time, that is, the expressions used while writing the StyleBook are validated during the import of StyleBook itself rather than while creating the configuration pack.
All references to parameters, substitutions, components, properties of components, outputs of components, user-defined variables (repeat-item, repeat-index, arguments to substitution functions) and so on are all validated for their existence and types.
Example of Type Checks:
In the following example, the expected type of port property of lbvserver
StyleBook is tcp-port
. In Citrix Application Delivery Management (ADM), the type validations happen at compile-time (import-time). The compiler finds that string and tcp-port
are not compatible types and therefore, the StyleBook compiler displays an error and fails to import or migrate a StyleBook.
components:
-
name: lbvserver-comp
type: ns::lbvserver
properties:
name: mylb
ipv46: 10.102.190.15
port: str("80")
servicetype: HTTP
<!--NeedCopy-->
To successfully compile this StyleBook, declare the following as a number in the compiler:
port: 80
Example of Flagging Invalid Expressions:
In earlier releases, when an invalid expression was assigned to a property name, the compiler did not detect invalid expressions and allowed the StyleBooks to be imported into Citrix ADM. Now if this StyleBook is imported to Citrix ADM, the compiler identifies such invalid expressions and flag it. As a result, the StyleBook fails to import to Citrix ADM.
In this example, the expression assigned to name property in lb-sg-binding-comp
component is: $components.lbvserver-comp.properties.lbvservername
. However, there is no property called lbvservername
in component lbvserver-comp
. In earlier Citrix ADM releases, the compiler would have allowed this expression and successfully imported it. The actual failure would happen when a user wants to create a configuration pack using this StyleBook. However now, this kind of error is identified during import and the StyleBook is not imported to Citrix ADM. Manually correct such errors and import the StyleBooks.
Components:
-
name: lbvserver-comp
type: ns::lbvserver
properties:
name: mylb
ipv46: 10.102.190.15
port: 80
servicetype: HTTP
-
name: sg-comp
type: ns::servicegroup
properties:
servicegroupname: mysg
servicetype: HTTP
-
name: lb-sg-binding-comp
type: ns::lbvserver_servicegroup_binding
condition: $parameters.create-binding
properties:
name: $components.lbvserver-comp.properties.lbvservername
servicegroupname: $components.sg-comp.properties.servicegroupname
<!--NeedCopy-->
Indexing Lists
Items of a list can be accessed now by indexing them directly:
Expression | Description |
$components.test-lbs[0] |
Refers to the first item in test-lbs component |
$components.test-lbs[0].properties.p1 |
Refers to property p1 of the first item in test-lbs component |
$components.lbcomps[0].outputs.servicegroups[1].properties.servicegroupname |
Refers to property servicegroupname of the second item in servicegroups component, which is an output from the first item of lbcomps component |
Share
Share
This Preview product documentation is Cloud Software Group Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Cloud Software Group Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Cloud Software Group product purchase decisions.
If you do not agree, select I DO NOT AGREE to exit.