# Using Reference Books¶

Reference book allows users to create groups of information that can be used in Batfish queries. They can contain:

Name

Description

Type

name

Name of the reference book

str

interfaceGroup

A list of interfaceGroups

List of interfaceGroup

Example usage

Create a reference book for information about border routers and add an InterfaceGroup for the as2 border interfaces

[4]:

interfacegroup = [InterfaceGroup('as2-border',
interfaces = [Interface('as2border1','GigabitEthernet2/0'),
Interface('as2border2', 'GigabitEthernet2/0')])]
refbook = ReferenceBook(name='border', interfaceGroups= interfacegroup)

bf.put_reference_book(refbook)



Example usage

Add an AddressGroup for the IP addresses of all as2 border interfaces to the ReferenceBook('border')

[5]:

refbook = bf.get_reference_book('border')
]

[6]:

refbook.addressGroups.extend(addressGroup)
bf.put_reference_book(refbook)

[7]:

bf.get_reference_book('border')

[7]: