{{indexmenu_n>5}}
====== Service-types ======
Service-types are basically scripted tasks which perform an automated task on the network in the database. These tasks can be:
- Add/remove devices to the network
- Add/remove topology
- Add/remove VLAN/IP-addresses
- Add/remove/enable/disable interfaces
- Add/remove/modify services
- etc…
The service types can be executed through the NetYCE API interfaces or from the NetYCE web-interface. Service types can create, modify or delete database objects, which can be located and used.
> Please consult the article [[guides:user:servicetypes:servicetypes|Service-types overview]] for an introduction to Service-types
> A complete reference to all service type commands is listed in [[guides:reference:servicetypes:servicetypes_syntax|Service-type syntax]].
===== Service-types form =====
The Service-types form is divided in 3 sections:
- Service types
- Rows within a selected service type
- Details and editing of a selected row
{{menu:design:service_types:service_types_form.png?nolink&1000}}
==== Service-types section ====
Within the Service types section, the user has an overview of the service types which belong to the Client types to which the user has access. Here a new service type can be added {{general:new.png?nolink}}, an existing service type can be deleted {{:general:delete.png?nolink}}or duplicated {{general:duplicate_button.png?nolink}}.
=== Adding or duplicating a service type ===
When adding or duplicating a service type the following data must be entered:
* Client type (drop down menu)
* Service class (drop down menu). This list is build from the available service classes of the client type.
* The name of the service type. This is chosen by the user.
* The name of the service task. Create is a reserved value
=== Deleting a service type ===
When you want to delete a service type, simply select the service type to be deleted and then click the Delete {{:general:delete.png?nolink}}button and the //OK// button.
=== Finding a service type ===
It is possible to search within the service types. Click the Search button {{:general:search.png?nolink}}and type the selection criteria in the search bar. Press **[enter]** to commit.
==== Rows ====
Within the second part of the window, the components of the selected service type are displayed. {{menu:design:service_types:servicetype_rows.png?nolink&1000}}
=== Adding a row ===
When adding a new row, the new row will be added after the current selected row. To add a row click the {{general:new.png?nolink}}button below the section. A new row will be added.
=== Deleting a row ===
In order to delete a row, click the {{general:delete.png?nolink}}icon below the section. You will be asked to confirm, click //OK// to delete the row.
=== Resequence rows ===
With the {{menu:design:service_types:up_button.png?nolink}}and {{menu:design:service_types:down_button.png?nolink}}buttons resequencing of the rows is possible. The aliases will not be updated!
==== Details of a row ====
{{menu:design:service_types:servicetype_detail.png?nolink}}
When selecting a row, the details will be displayed in the third section of the form. After each updated value, the next field will be updated to ensure the accurate syntax. The description field can be used as comment. It is also possible to add an empty row and use this as a comment row. In this case only the description field will be set.
=== Alias ===
The **alias** is being used only internally within a Service type script to use the result of one row as a variable in another row. It is advisable to use distinctive names for aliases as well as surround them by to identify them visually as such.
Please refer to [[guides:user:servicetypes:servicetypes_overview#alias_names|Service-types overview]] for some guidelines on Alias names.
===== Syntax =====
The definition of a Service type is done with a specific syntax, which is guided by the visual editor. The **Add** and **Locate** can be assigned **aliases**, to be used as a reference to the object in the commands following it.
In general, everything written in UPPERCASE are syntax keywords, everything written in lowercase are **aliases** or **values**.
> The article on [[guides:reference:servicetypes:servicetypes_syntax|Service type syntax]] offers a summary of the service-type commands available. They are grouped around the various object types that NetYCE supports.
==== Example ====
The following example will add a node to a newly created service with a IP address assigned to interface Loopback0.
^Sequence ^Exec ^Class ^Scope ^Match ^Value ^Alias |
|1 |ADD |SERVICE |SITE |CURRENT | | |
|2 |ADD |NODE | |NODE_TYPE |LAN_ACCESS | |
|3 |ADD |SUBNET | |NET_NAME |Loopback | |
|4 |LOCATE |ADDRESS |ADDRESS_FIRSTFREE |Lo0 | | |
|5 |LOCATE |PORT | |PORT_TEMPLATE_FIRST |Loopback0 | |
|6 |ASSIGN |ADDRESS | |PORT | | |
A whole set of example Service types is included in every distribution. You can copy and adapt them to suit your own architecture.
====== Node and information structure ======
The below diagram shows how some of the database information for Nodes, Services, subnets, etc. is structured. This could help you design your service types and help you understand how each of the pieces tie together.
{{:menu:design:service_types:build_db_relations.png?nolink|}}