Generic Object Example
In this example we'll use generic objects to represent the components that make up a software-defined networking firewall definition.
The firewall software uses the concept of firewall groups to define rules for allowed and denied network connectivity. The firewall groups comprise one or more address groups, network groups and port groups. A typical group definition on the firewall might be as follows:
To represent each of these firewall components in the CloudForms VMDB we'll create 4 new generic object class definitions, as follows:
Firewall Group
Address Group
Network Group
Port Group
The Firewall Group generic object has associations to one or more of each of the other three generic object types. The Address Group, Network Group and Port Group object types have a single association back to their related Firewall Group.
Note
For simplicity of illustration, the code that connects to the external software defined firewall service to implement the firewall is not shown.
The Generic Object class definitions are as follows:
Firewall Group
The Firewall Group generic object class definition is shown in screenshot Firewall Group Generic Object Definition
Address Group
The Address Group generic object class definition is shown in screenshot Address Group Generic Object Definition
Network Group
The Network Group generic object class definition is shown in screenshot Network Group Generic Object Definition
Port Group
The Port Group generic object class definition is shown in screenshot Port Group Generic Object Definition
Provisioning the Generic Objects
The generic objects are provisioned individually.
Firewall Group
A Firewall Group generic object is provisioned from a service. The service dialog is shown in screenshot Service Dialog - Ordering a Firewall Group
The Ansible playbook service runs the following playbook:
Address Group, Network Group and Port Group
The Address Group, Network Group and Port Group objects are each created by a Ruby method written to be callable either from a button on the firewall group's generic object, or from a service provision state machine.
For example the following code snippet creates the Network Group generic object:
If the Address Group, Network Group and Port Group objects are provisioned from a service, their related Firewall Group should already exist. The Firewall Group with which to associate the new generic object is selected from a dynamic drop-down in the service dialog (see screenshot Service Dialog - Ordering a Network Group).
The dynamic drop-down element is populated by the following Ruby method:
Completed Objects
Once completed the generic objects provide a graphical represntation of the firewall groups. Firewall Groups shows the top-level firewall groups.
Clicking on the named link for a firewall group navigates to the details of that firewall group generic object (see screenshot Firewall Group Details).
Clicking on the port_groups association shows the generic objects representing the individual port groups (see screenshot Port Groups).
Clicking on the named link for a port group navigates to the details of the port group. The association back to the firewall group can be seen (and can be clicked to navigate back if required) (see screenshot Port Group Details).
Summary
This chapter has illustrated how generic objects can be used to model external entities using CloudForms VMDB objects, including modelling the relationships between entities as associations between objects. The scripts are available here
Last updated